PHP smarty Template Simple use method _php instance

Source: Internet
Author: User
Tags smarty template
This article explains the simple use of PHP smarty templates. Share to everyone for your reference, as follows:

index.php:

Require ('.. /libs/smarty.class.php '); $smarty = new smarty;//Add a custom adjuster $smarty->registerplugin ("modifier", "E", " Htmlspecialchars "), $smarty->registerplugin (" modifier "," trim "," trim ");//$smarty->force_compile = true;$ Smarty->debugging = true; $smarty->caching = true; $smarty->cache_lifetime = 120;//definition identifier $smarty->left_ delimiter = ' {'; $smarty->right_delimiter = '} ';//Bind variable $smarty->assign ("test_html", "haha"); $smarty->display (' Index.tpl ');

INDEX.TPL:

{$test _html|e}

PostScript: How to get vs support for HTML editing of the TPL extension

Set in the menu [Tools > Options], such as:

More interested in PHP related content readers can view this site: "PHP Network Programming Skills Summary", "PHP Basic Grammar Introductory Tutorial", "PHP operation Office Document Skills Summary (including word,excel,access,ppt)", " PHP Date and Time usage summary, PHP Object-oriented Programming primer, PHP string usage Summary, PHP+MYSQL Database Operations Primer, and PHP Common database operations Tips Summary

I hope this article is helpful to you in PHP programming.

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