PHP Smarty template simple use method, phpsmarty Template
This article describes how to use the PHP Smarty template. We will share this with you for your reference. The details are as follows:
Index. php:
Require ('.. /libs/Smarty. class. php '); $ smarty = new Smarty; // Add a custom regulator $ smarty-> registerPlugin ("modifier", "e", "htmlspecialchars "); $ smarty-> registerPlugin ("modifier", "trim", "trim"); // $ smarty-> force_compile = true; $ smarty-> debugging = true; $ smarty-> caching = true; $ smarty-> cache_lifetime = 120; // define the identifier $ smarty-> left_delimiter = '{'; $ smarty-> right_delimiter = '}'; // bind the variable $ smarty-> assign ("test_html", "<a> haha </a>"); $ smarty-> display ('index. tpl ');
Index. tpl:
<H1 >{$ test_html | e}
Postscript: How to Make VS support HTML editing with the tpl extension
Set in the menu [tools> options], for example: