This article mainly introduces the simple usage of the PHPSmarty template, and analyzes the configuration, variable setting, and usage of PHP's Smarty template call in the form of an instance, for more information about how to use the PHP Smarty template, see the example in this article. 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: