Include .php into index.tpl

Hi,



I have tried everything to include a simple cookie/index.php into the skins → index.php



{php}

include 'cookie/index.php';

{/php}



{include_php file=“cookie/index.php”}



$config[“tweaks”][“allow_php_in_templates”] = true; // Allow to use {php} tags in templates



I hope someone can help me!



Kind regards,

Bas

  1. Including PHP in templates is a bad idea. Better to assign variables with your data and then reference it in the template.



    What error/problem are you getting?



    Put your store in Development Mode or flush the cache after you change a template.

Hi,

You can load php scripts within controller addons/my_changes/controllers/customer/init.post.php and if you won't to display something to the customer you can hook skins/[SKIN_NAME]/customer/addons/my_changes/hooks/index/footer.tpl or any other hook from skin





Valentin

You might try an absolute path versus a relative path to your file.

If i include i am getting this error:



Notice: Constant AREA already defined in /home/…/html/update/index.php on line 20 Notice: Constant AREA_NAME already defined in /home/…/html/update/index.php on line 21 Notice: Constant ACCOUNT_TYPE already defined in /home/…/html/update/index.php on line 22 Fatal error: Cannot redeclare fn_get_ini_param() (previously declared in /home/…/html/update/prepare.php:131) in /home/directdesign/html/update/prepare.php on line 139

You are approaching the problem incorrectly and you need to review the documentation and articles on setting up template variables in the controller.