简体   繁体   中英

I want to write PHP code for a Smarty .tpl file

I want to write PHP code for a Smarty .tpl file. But it is giving me the following error:

Uncaught --> Smarty Compiler: Syntax error in template "./templates/register.tpl" on line 185 "{php}" unknown tag "php" <-- thrown in /opt/lampp/htdocs/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 185

When I Google it, I realized it's deprecated and not recommended to use. What should I do now? I want to show drop down with the security question in it.

Not sure what Smary is or how it is used, but what I get from documentation is that {php} is deprecated.

http://www.smarty.net/docs/en/language.function.php.tpl

回传{$foo} tpl文件中的$ foo变量

You should make changes in smarty_securoty.php and make

public $allow_php_tag = false; to

public $allow_php_tag = true;

it allow PHP Code in .tpl file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM