Hello all!
I need to place some php code inside the content of a page. But it always gets screwed up when saving.
I did deactivate WYSIWYG before pasting the code in. And I also used the {literate}{/literate} tags.
But it always takes the code out by placing <!-- in it.
How can I get this to work properly?
(And no, I could not find anything about this by searching the forum or google)
Regards,
Thomas
PHP in page content
-
- Power Poster
- Posts: 751
- Joined: Fri Sep 12, 2008 2:34 pm
Re: PHP in page content
Activate php in your config.php
use {php} your code {/php} in the content
Code: Select all
#------------------
#Usability Settings
#------------------
#Allow smarty {php} tags? These could be dangerous if you don't trust your users.
$config['use_smarty_php_tags'] = true;
Re: PHP in page content
Thank you for your quick answer, nockenfell.
So I understand it {literate} {/literate} is not necessary any more and {php} and {/php} replace the <?php and ?>, right?
And this goes the same in template as in page content?
Greetings,
Thomas
So I understand it {literate} {/literate} is not necessary any more and {php} and {/php} replace the <?php and ?>, right?
And this goes the same in template as in page content?
Greetings,
Thomas
-
- Power Poster
- Posts: 751
- Joined: Fri Sep 12, 2008 2:34 pm
Re: PHP in page content
correct.thomahawk wrote:Thank you for your quick answer, nockenfell.
So I understand it {literate} {/literate} is not necessary any more and {php} and {/php} replace the <?php and ?>, right?
i think so. but i'd never test this.And this goes the same in template as in page content?
Re: PHP in page content
Unless you have a very compelling reason to actually put the PHP code in your actual page content, it would be better to put the PHP code in a UDT (without the <?php and ?> tags, and then call the UDT in your page content. Safer and harder to screw up.thomahawk wrote:Hello all!
I need to place some php code inside the content of a page. But it always gets screwed up when saving.