Create the templates, templates_c, configs, and cache directories in the Smarty directory. So that Smarty can be compiled and cached. Create a smarty_inc.php file and configure smarty as follows:
Create the templates, templates_c, configs, and cache directories in the Smarty directory. So that Smarty can be compiled and cached.
Create a smarty_inc.php file and configure smarty as follows:
Caching = false; // It is not recommended to enable cache $ smarty-> template_dir = ". /templates "; // set the template directory $ smarty-> compile_dir = ". /templates_c "; // Set the compilation directory $ smarty-> cache_dir = ". /cache "; // cache folder $ smarty-> cache_lifetime = 60; $ smarty-> left_delimiter =" <{"; // left delimiter $ smarty-> right_delimiter = "}>"; // right delimiter?>
Line test: create the index. php file in the root directory:
Assign ("name", $ val); $ smarty-> display ("index.html");?>
Create an index.html template under templates:
Test page<{Foreach from = $ name item = x}> array content: <{$ x}>
<{/Foreach}>
Well, it's just that simple. start your journey to smarty...