Jump to content

Smarty - Include PHP Errors (WHMCS V7)


Fr3DBr

Recommended Posts

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 ?

Link to comment
Share on other sites

you may need to declare the path in your configuration file. :idea:

 

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.

Link to comment
Share on other sites

  • 2 months later...

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',
       ),
   ),
);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated