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.