PHPSmarty templates are simple to use. The PHPSmarty template is simple to use. the phpsmarty template in this article describes how to use the PHPSmarty template. For your reference, refer to Index. php: simple use of the require PHP Smarty template and 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", "haha"); $ smarty-> display ('index. tpl ');
Index. tpl:
{$ Test_html | e}
Postscript: how to make VS support HTML editing with the tpl extension
Set in the menu [Tools> Options], for example: