Loading

Smarty

Smarty五配置两方法

<?php

  require('../smarty/Smarty.class.php');

  $smarty=new Smarty();

  //Smarty"五配置两方法"

  //五配置的介绍

  $smarty->left_delimiter="{";  //左定界符

  $smarty->right_delimilter="}";  //右定界符

  $smarty->template_dir="tpl";  //html模板的地址

  $smarty->compile_dir="template_c";  //模板编译生成的文件

  $smarty->cache_dir="cache";  //缓存

  //两方法开启缓存,因为通常不开启缓存机制,所以此项为了解

  //$smarty->caching = true;  //开启缓存

  //$smarty->cache_lifetime = 120;  //缓存时间

 

  $smarty->assign('articletitle','文章标题');  

  $smarty->display('test.tpl');

?>

posted @ 2017-03-08 16:58  王树燚  阅读(161)  评论(0编辑  收藏  举报