Smarty simple entry examples, smarty examples
This article analyzes the usage of smarty with a simple example. Share it with everyone for your reference. The specific analysis is as follows:
After smarty creates the configuration file and displays the file, the configuration file displays the file separately, so that the art and development work can be perfectly separated
Configuration page code: index.php
Copy code The code is as follows:
@header("Content-type: text/html; charset=UTF-8");
require '../libs/Smarty.class.php';
$my=new Smarty;
$my->template_dir ='templates/';
$my->compile_dir ='templates_c/';
$my->config_dir ='configs/';
$my->cache_dir ='cache/';
$my->assign('content','welcome to arrival');
$my->assign('mylife',array("life","eating","dream","cool breeze"));
$my->display('kk.html'); //Display kk.html in the smarty directory
?>
kk.html
Copy code The code is as follows:
Untitled Document
{$content}
{section name=truelife loop=$mylife}
{$mylife[truelife]}
{/section}
I hope this article will be helpful to everyone’s smarty programming design.
http://www.bkjia.com/PHPjc/919262.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/919262.htmlTechArticlesmarty simple entry example, smarty example This article uses a simple example to analyze the usage of smarty. Share it with everyone for your reference. The specific analysis is as follows: smarty creates configuration files and displays...