Smarty's assign () function

Source: Internet
Author: User


The main thing is to pay the value of the program inside the template, because when using smarty, there is no PHP code inside the template, can not display the value of the variables generated during the operation process, so you can use a function of PHP inside the value of the smarty, so that in the template display
For example:
If I want to display the value of a variable on a page, such as
$ABC = "This is the value of a variable";
then I use Smarty's assign () function in the program as follows:
$smarty->assign ("AAA", $ABC);
at this point, in the Smarty class there will be a variable AAA containing the value of $ABC, so that in the template can be like the following way to show his value
the value of the variable is: {$AAA}

(1) If there is {} in the code of the HTML, {literal}{/literal} must be added in the middle of the html{} in order to display properly.

(2) PHP debugging in Linux can be used: PHP xxx.php so that the error message can be displayed.

Smarty's assign () function

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: 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.