What potential issues can arise when using Smarty for subtemplates in PHP?

One potential issue that can arise when using Smarty for subtemplates in PHP is the lack of proper escaping of variables, which can lead to security vulnerabilities such as cross-site scripting (XSS) attacks. To solve this issue, always use Smarty's built-in escape functions like {$variable|escape} to properly sanitize user input before outputting it in templates.

// Example of using Smarty's escape function to prevent XSS attacks
$smarty->assign('user_input', '<script>alert("XSS attack")</script>');
$smarty->assign('escaped_input', $smarty->escape('html', $user_input));
$smarty->display('subtemplate.tpl');