smarty
文章平均质量分 73
zhaohehe123
这个作者很懒,什么都没留下…
展开
-
smarty总结(3)
四、变量修改器(modifier) 1.概念及用法:修饰smarty中的变量,用法和函数类似。 2.语法格式:smarty_var|modifier:parm1:parm2..|modifier2….执行顺序从左到右。 3.系统自带的modifier(capitalize/date_format/count*/upper、default)详见说明书 4.自定义modifier(给相应的文字原创 2012-11-25 07:53:41 · 250 阅读 · 0 评论 -
smarty模板设计
Smarty模板技术 一、什么是Smarty? 1.概念:是使用PHP写出来的模板引擎,实现了后台逻辑(*.php)和外在内容(前台页面)分离,将php程序员和美工设计人员进行分离。应用Smarty的网站程序逻辑的改变不会影响美工页面的设计,美工设计从新修改之后不会影响到程序逻辑。 2.优点: 在比较大的项目中才得以体现:当后台数据没有变化的时候,只需一次编译,只有当后台数据发生变时,页面原创 2012-11-07 20:22:04 · 287 阅读 · 0 评论 -
$smarty.config
从配置文件读取的变量 配置文件中的变量需要通过用两个"#"或者是smarty 的保留变量 $smarty.config来调用 例子: a.conf 文件 bgcolor=#00cccc display=true [mycolor] bgcolor=#96ffcc [yourcolor] bgcolor=#847591 if.tpl 文件 Tr原创 2012-11-08 19:33:19 · 352 阅读 · 0 评论 -
$smarty.now
{$smarty}保留变量——{$smarty.now} 例子: variables.tpl http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> http://www.w3.org/1999/xhtml"> 无标题文档 > 现在的时间是: variables.php include原创 2012-11-08 19:47:54 · 556 阅读 · 0 评论 -
利用foreach和section遍历数组元素
利用foreach遍历数组元素 foreach.php $array=array( array("id"=>"1","name"=>"张三","age"=>18), array("id"=>"2","name"=>"李斯","age"=>19),//section不能遍历关联数组 array("id"=>"3","name"=>"王五","age"原创 2012-11-12 16:21:42 · 473 阅读 · 0 评论 -
输出php传递给模板文件的普通变量及对象
普通变量 var.php include("libs/Smarty.class.php"); $smarty=new Smarty(); $smarty->reInitSmarty("demo/templates", "demo/templates_c","demo/config"); $smarty->assign("name","张三"); $smarty->display(原创 2012-11-12 16:44:05 · 663 阅读 · 0 评论 -
输出php传递给模板文件的索引数组变量,关联数组变量
索引数组变量 array_suo.php $array=array( array(1,"张三",18,'女'), array(2,"李斯",19,'男'), array(3,"王五",20,'男'), );//索引数组 include("libs/Smarty.class.php"); $smarty=new Smarty();原创 2012-11-12 16:51:12 · 887 阅读 · 0 评论 -
$smarty的保留变量
variables.php include("libs/Smarty.class.php"); setcookie("name","Tom"); $arr=array(1,2,3,4,5,6,7); $smarty=new Smarty(); $smarty->reInitSmarty("demo/templates","demo/templates_c","demo/conf原创 2012-11-12 18:43:39 · 336 阅读 · 0 评论 -
变量调节器
bianliang.php include("../libs/Smarty.class.php"); $smarty=new Smarty(); $smarty->reInitSmarty ("../demo/templates","../demo/templates_c","../de mo/config"); $string="hello hi.\nphp!"; $sm原创 2012-11-12 18:50:00 · 205 阅读 · 0 评论 -
缓存
1.什么是缓存(cache)? 内存(临时存放数据,解决cpu和外部设备之间速度不匹配) 高速缓存(cache)(解决cpu和内存之间速度不匹配的问题) 作用:提高计算机数据的访问速度 网站设计中(软件开发中) 缓存的概念:在PHP中,缓存就是就是硬盘中的一块区域,将生成的不变的页面放入这块区域中,相当于直接放入了缓存。当用户重复访问相同页面的时候,直接从缓存区域调用页面。 2.如何应原创 2012-11-19 07:58:14 · 189 阅读 · 0 评论 -
缓存实例
实现上个作业中的学生成绩不缓存,当数据库中学生成绩发生变化时,页面数据也发生变化。 stu.php include("connect.php"); include("../libs/Smarty.class.php"); $smarty=new Smarty(); $smarty->caching=1; $smarty->reInitSmarty("../demo/templ原创 2012-11-19 20:18:48 · 300 阅读 · 0 评论 -
smarty总结(1)
Smarty模板技术 一. Smarty的优点,作用。 实现了前台页面和后台逻辑的分离。在比较大的项目中,将php程序员和美工设计人员分离。 二. Smarty相关知识点: 1. 如何使用Smarty模板,使用模板的步骤 1) 安装smarty(将smarty安装包中的libs文件夹拷贝到服务器目录下即可) 2) 引入smarty.class.p原创 2012-11-20 20:43:25 · 227 阅读 · 0 评论 -
smarty总结(2)
#全局变量 变量名 = 变量值(非字符类直接写、字符类的加’…’或”…”、大段字符包括段落标记等”””…..”””) Name = ‘张三’ Age =19 #局部变量 [局部名称]//声明局部变量的作用域 变量名 = 变量值(非字符类直接写、字符类的加’…’或”…”、大段字符包括段落标记等”””…..”””) Name = ’李四’ 注意:局部变量的变量名一般会包含在全局原创 2012-11-20 20:45:05 · 232 阅读 · 0 评论 -
利用if实现文本位置的不同显示
array_from.html http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> http://www.w3.org/1999/xhtml"> 无标题文档 输入学号查询: 选择显示方式: left center right array_from.php原创 2012-11-12 15:39:22 · 257 阅读 · 0 评论