Smarty Simple Getting Started instance, smarty instance
This paper analyzes the usage of smarty with a simple example. Share to everyone for your reference. The specific analysis is as follows:
Smarty set up the configuration file, display the file, the configuration file display file separate, so that the art and development work can be separated perfectly
Configuration page code: index.php
Copy the Code code as follows: <?php
@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", "Eat", "Dream", "Cool Breeze"));
$my->display (' kk.html '); Show kk.html in Smarty directory
?>
Kk.html
Copy the Code code as follows:
Untitled Document
{$content}
{section Name=truelife loop= $mylife}
{$mylife [TrueLife]}
{/section}
It is hoped that this article is helpful to everyone's smarty program design.
http://www.bkjia.com/PHPjc/919262.html www.bkjia.com true http://www.bkjia.com/PHPjc/919262.html techarticle Smarty Simple Getting Started instance, smarty example this paper analyzes the usage of smarty with a simple example. Share to everyone for your reference. The specific analysis is as follows: Smarty Setup profile, display ...