Php In Templates

Morning all,

We're not after a "why you shouldn't use php in templates" discussion, but trying to figure out why this isnt working.

Theres various thread that suggest within your `config.local.php` you can do

$config['tweaks'] = array (
    'allow_php_in_templates' => true
);

however then inside say `index.tpl` i try and do

{php}
echo "hello";
{/php}

Then preview any page, it simply responds with an 500 Internal Server Error, but nothing shows in the server error logs.

We're using version 4.2.3

Why would this page be erroring?

Thank you

Morning all,

We're not after a "why you shouldn't use php in templates" discussion, but trying to figure out why this isnt working.

Theres various thread that suggest within your `config.local.php` you can do

$config['tweaks'] = array (
    'allow_php_in_templates' => true
);

however then inside say `index.tpl` i try and do

{php}
echo "hello";
{/php}

Then preview any page, it simply responds with an 500 Internal Server Error, but nothing shows in the server error logs.

We're using version 4.2.3

Why would this page be erroring?

Thank you

This tweak was removed from latest CS-Cart versions. You can create function in the func.php file of your addon and call it in template in the following manner:

{$result = $var1|fn_my_custom_function:$var2:$var3}