Page 1 of 1

PHP in content or templates

Posted: Thu May 17, 2007 9:01 pm
by Hollywood
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:


Re: PHP in content or templates

Posted: Thu May 17, 2007 9:09 pm
by Nullig
Your config.php must be edited to include:

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 
Nullig

Re: PHP in content or templates

Posted: Sat May 19, 2007 3:37 am
by Hollywood
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?

Re: PHP in content or templates

Posted: Sat May 19, 2007 4:02 pm
by calguy1000
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:

Code: Select all

{php}phpinfo();{/php}