Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Php In Templates Rate Topic   - - - - -

 
  • jjscruff
  • Newbie
  • Members
  • Join Date: 10-Aug 14
  • 13 posts

Posted 18 April 2016 - 06:10 PM #1

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

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19709 posts

Posted 19 April 2016 - 08:18 AM #2

 

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}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.