Page 1 of 1
Is it possible to use PHP inside tpl-files?
Posted: Tue Feb 12, 2008 10:15 am
by twe
I'm in the process of integrating s9y into an existing website that uses a lot of php for other aspects of the side. Is it possible to somehow get php instructions within the tpl file executed? They are called from a php-file afterall, aren't they?
Re: Is it possible to use PHP inside tpl-files?
Posted: Tue Feb 12, 2008 10:54 am
by garvinhicking
Hi!
See the Smarty {php} syntax, and you must disable template security of your s9y template by editing/creating a config.inc.php file:
Code: Select all
<?php
$serendipity['smarty']->security = false;
?>
Regards,
Garvin
Posted: Tue Feb 12, 2008 11:06 am
by twe
Thanks a lot for the fast reply!
Are there any negative side effects / security risks to watch out - if you only use tpl-files that have been checked (for unwanted php)?
Posted: Tue Feb 12, 2008 11:13 am
by garvinhicking
Hi!
Turning of the security simply means that you can only give FTP system access to users that you absolutely trust (because they can easily executy any PHP inside your templates now). Also it means that if you've got plugins like smartymarkup, your users can inject PHP code from within their articles.
Regards,
Garvin