Is it recommended to manipulate file names within the template system code in PHP?

It is not recommended to manipulate file names directly within the template system code in PHP as it can introduce security vulnerabilities and make the code harder to maintain. Instead, it is better to pass the necessary file names as variables to the template system and handle any manipulations outside of the template code.

// Pass the file names as variables to the template system
$templateData = [
    'header' => 'header.php',
    'footer' => 'footer.php',
    'content' => 'content.php'
];

// Include the template file using the passed variables
include $templateData['header'];
include $templateData['content'];
include $templateData['footer'];