Fr3DBr Posted April 1, 2017 Share Posted April 1, 2017 Hi, guys. In WHMCS V6, my template is working just fine, to include php files, however now I'm testing V7 and I've noticed a problem: Smarty Error: Syntax error in template "file:/home/webpath/public_html/templates/mytemplate/header.tpl" on line 69 "{include_php file="$template/header_ex.php"}" {include_php} file 'mytemplate/header_ex.php' is not readable What could be the reason for this ? The php file is located in the template directory, together the tpl files, and as I said in V6 it works fine ? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 1, 2017 Share Posted April 1, 2017 try {include_php file="templates/$template/header_ex.php"} 0 Quote Link to comment Share on other sites More sharing options...
Fr3DBr Posted April 1, 2017 Author Share Posted April 1, 2017 try {include_php file="templates/$template/header_ex.php"} I did exactly this before, but the result was exactly the same too. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 2, 2017 Share Posted April 2, 2017 you may need to declare the path in your configuration file. http://docs.whmcs.com/Smarty_Security_Policy Using {include_php} Syntax Smarty has deprecated the {include_php} syntax, but WHMCS currently supports this behavior via Policies. If your template invokes & includes a PHP script by using the Smarty {include_php} syntax, the full path to the directory containing that script will need to be whitelisted in the 'trusted_dir' setting of your Policy. 0 Quote Link to comment Share on other sites More sharing options...
Fr3DBr Posted April 2, 2017 Author Share Posted April 2, 2017 you may need to declare the path in your configuration file. http://docs.whmcs.com/Smarty_Security_Policy Ah :) This explains it. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
MACscr Posted June 7, 2017 Share Posted June 7, 2017 Hmm, Im having the same issue after upgrading, yet im not getting any errors (I do have $display_errors=true in my config, just blanks when im using {include_php}. I added the following to my configuration.php with no difference as well: // Smarty custom email based template policy: $smarty_security_policy = array( 'mail' => array( 'php_functions' => array( 'ucwords', ), 'php_modifiers' => array( 'strpos', ), ), 'system' => array( 'trusted_dir' => array( '/var/www/html/custom_files', ), ), ); 0 Quote Link to comment Share on other sites More sharing options...
ChrisTERiS Posted June 12, 2017 Share Posted June 12, 2017 Maybe I'm out of topic but Smarty version 3+, for security reasons, has disabled by default PHP code and includes. WHMCS follows it but it has an option in General settings (I think in Security tab) where you can activate PHP support in templates. As I said, there is a chance to be out of topic as I don't know what Smarty version WHMCS 6 was using. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.