Can smarty use php source code in the template file? Solution
Source: Internet
Author: User
Can smarty use php source code in the template file? I haven't heard of any source code writing yet, you can directly use the insert label to call the method you want to implement, just like {insertname = 'cart _ info'}. Yes, after newsmarty, can I set a property to true to use the php source code for smarty in the template file?
Can smarty use php source code in the template file?
------ Solution --------------------
I haven't heard of any source code.
------ Solution --------------------
Directly use the insert label to call the method you want to implement, just like {insert name = 'cart _ info '}.
------ Solution --------------------
Yes. after new smarty, set an attribute to true.
You have forgotten the property name.
------ Solution --------------------
It looks like:
$ Smarty-> php_handling = SMARTY_PHP_ALLOW;
However, this manual is used to execute code between {php} {/php.
I used it before January. I don't know which attribute it is.
That can be executed directly. Content in
------ Solution --------------------
$ Smarty-> allow_php_templates = true;
It should be this and then directly in the template
{Php} CODE...
------ Solution --------------------
Compared with smarty2.x, smarty3.0 supports writing PHP source code directly in the template file, or defining variables in the template file.
Smarty3.0 manual Co., http://d.download.csdn.net/down/3175585/python _.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service