Smarty in the template file can be used in PHP source code IT Solution

Source: Internet
Author: User
Tags php source code
Smarty in the template file can be used in PHP source code?
Smarty in the template file can be used in PHP source code?

------Solution--------------------
I haven't heard of a source code yet.
------Solution--------------------
Just use the insert tag to invoke the method you want to implement like {Insert Name= ' cart_info '}.
------Solution--------------------
Yes, after new smarty, it is possible to set a property to true.
Attribute name forget it, you check it yourself.
------Solution--------------------
Seems to be:
$smarty->php_handling = Smarty_php_allow;
But this just read the manual, is executing {php}{/php} between the code.
I used it before January, and I don't remember which attribute it was.
That's something that can be executed directly .


------Solution--------------------

$smarty->allow_php_templates = true;
That should be it. Then in the template directly
{PHP} CODE ..... {/php} is available.
------Solution--------------------
Compared to the smarty2.x version, smarty3.0 supports writing PHP source code directly in the template file, or you can define variables in the template file.
smarty3.0 Manual Download Address Http://d.download.csdn.net/down/3175585/python_
  • Related Article

    Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.