smarty半小时快速上手入门教程
本文讲述了smarty快速上手入门的方法,可以让读者在半小时内快速掌握smarty的用法。分享给大家供大家参考。具体实现方法如下:
一、smarty的程序设计部分:
在smarty的模板设计部分我简单的把smarty在模板中的一些常用设置做了简单的介绍,这一节主要来介绍一下如何在smarty中开始我们程序设计。下载Smarty文件放到你们站点中。
index.php代码如下:
<?php
/**
*
*@version$Id:index.php
*@package
*@authorwww.nhooo.com
*@action显示实例程序
*/
include_once("./Smarty/Smarty.class.php");//包含smarty类文件
$smarty=newSmarty();//建立smarty实例对象$smarty $smarty->templates("./templates");//设置模板目录 $smarty->templates_c("./templates_c");//设置编译目录 $smarty->cache("./cache");//缓存目录 $smarty->cache_lifetime=0;//缓存时间 $smarty->caching=true;//缓存方式
$smarty->left_delimiter="{#"; $smarty->right_delimiter="#}"; $smarty->assign("name","zaocha");//进行模板变量替换 $smarty->display("index.htm");//编译并显示位于./templates下的index.htm模板 ?>
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿