Smarty Variable Errors

Problem

You see the following warning when the system loads a template:

Smarty Error: Syntax error in template "file:/var/www/html/whmcs/admin/templates/blend/header.tpl" on line 73 "Current template: {$smarty.template_object->template_resource}" special variable '$smarty.template_object' not allowed by security setting

Cause

Smarty 4 applies stricter security rules compared to earlier versions. Smarty Security Policy restricts access to special variables such as $smarty.template_object by default.

Solution

To resolve this error, you must remove the special variable referenced in the error message.

Then, refactor your template logic to use assigned variables instead of {$smarty} special variables.

To learn about assigning variables, see Smarty’s Assigning Variables documentation.

Last modified: 2025 December 16