smarty实例教程,smarty实例教程
【 tulaoshi.com - PHP 】
六。smarty的程序设计部分:
在smarty的模板设计部分我简单的把smarty在模板中的一些常用设置做了简单的介绍,这一节主要来介绍一下如何在smarty中开始我们程
序设计。
PHP代码:--------------------------------------------------------------------------------
    首先来介绍一下在上一节中我们使用的过的.php文件中的一些元素。同样,我们拿上一节中最开始的那个index.php文件来说明一下:
    
   ================================================
     index.php
   ================================================
   <?php
     /*********************************************
      *
      * 文件名: index.php
      * 作  用: 显示实例程序
      *
      * 作  者: 大师兄
      * Email:  teacherli@163.com
      *
      *********************************************/
      include_once("./comm/Smarty.class.php"); //包含smarty类文件
      $smarty = new Smarty();  //建立smarty实例对象$smarty
      $smarty-templates("./templates"); //设置模板目录
      $smarty-templates_c("./templates_c"); //设置编译目录
      //****大家注意,这里我是我新加入的****//
      $smarty-cache("./cache"); //设置缓存目录
      $smarty-cache_lifetime = 60 * 60 * 24;  //设置缓存时间
      $smarty-caching = true;      //设置缓存方式
      
      //----------------------------------------------------
      //左右
                        
来源:http://www.tulaoshi.com/n/20160129/1491815.html