In what scenarios would a template class work seamlessly with HTML content but encounter problems with PHP scripts?

A template class may work seamlessly with HTML content because it can easily handle the structure and layout of the webpage. However, it may encounter problems with PHP scripts if the class does not properly handle PHP code within the template. To solve this issue, the template class needs to be modified to correctly parse and execute PHP scripts embedded within the HTML content.

<?php
class Template {
    public function render($templateFile, $data) {
        ob_start();
        extract($data);
        include $templateFile;
        return ob_get_clean();
    }
}

// Example usage
$template = new Template();
$data = ['name' => 'John Doe'];
$htmlContent = $template->render('template.php', $data);
echo $htmlContent;
?>