I'd like to use PHP to conditionally include files in my templates and content. Is this possible -- inserting PHP code in templates or content records a la:
PHP in content or templates
Re: PHP in content or templates
Your config.php must be edited to include:
Nullig
Code: Select all
#Allow smarty {php} tags? These could be dangerous if you don't trust your users.
$config['use_smarty_php_tags'] = true; <--this has to be set to true
Re: PHP in content or templates
Hmm... I did this and reloaded the page with the PHP code in the template, and I'm still not seeing the code that the PHP renders appear. Do I need to do something else to get it to appear?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: PHP in content or templates
once 'use_smarty_php_tags' is turned on in your config.php
you need to surround the php code with {php} and {/php} instead of
i.e:
you need to surround the php code with {php} and {/php} instead of
i.e:
Code: Select all
{php}phpinfo();{/php}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.