
smarty
北方的刀郎
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Smarty foreach 循环次数 首次 末次
foreach,foreachelse{foreach from=$variable key=key name=name iteam=value} {$variable|@count} // 获取数组长度 {$smarty.foreach.loop.index} // 获取当前循环数组元素下标,以0开始 {$smarty.foreach.loop.iteration原创 2016-03-21 10:41:34 · 1875 阅读 · 0 评论 -
【转载】smarty --foreach详解(不错不错)
温馨提示:内容是中英文对照写的,其中绿色字体是翻译后的Chapter 7. Built-in Functions 第7章 内建函数 {foreach},{foreachelse}用于像访问序数数组一样访问关联数组 {foreach},{foreachelse} {foreach} is used to loop over an associative array as well a num原创 2016-03-21 10:48:46 · 533 阅读 · 0 评论 -
smarty中数组array怎么使用呢
smarty中数组array怎么使用呢 提问:kdchxue 代码如下: 以下是html的代码: {section name=list loop=$title} {$title[list].name},{$title{list}.date} {/section} 以下是php的代码: include ("smarty_inc.php");原创 2016-03-21 10:48:43 · 4127 阅读 · 0 评论 -
{html_options options=$item.options selected=$item.value}
{html_options}{html_options}是一个自定义函数, 可以使用提供的数据,生成HTML的标签,还可以设置选中项等属性。参数名称类型必选参数默认值说明valuesarrayYes, 除非使用 options 属性n/a下拉框值的数组outputarrayYes, 除非使用 o原创 2016-03-21 10:48:38 · 620 阅读 · 0 评论 -
smarty 去除html标签,并截取后加\"...\"
{assign var="article" value=$articledata->GetArticle(26)} {$article->content|strip_tags|truncate:550:"...":true} 杭州锐高机械制造有限公司是一家集科研、设计、制造、销售、安装、维修、服务于一体,专业生产销售大型贮原创 2016-03-21 10:44:44 · 1374 阅读 · 0 评论 -
smarty truncate 用法 {$articleTitle|truncate:30:\"...\":true}
Parameter Position参数位置Type参数类型Required必需Default默认Description描述1integerNo80This determines how many characters to truncate to.截取字符的数量2stringNo...This is the text to append if truncati原创 2016-03-21 10:43:46 · 2322 阅读 · 1 评论 -
Smarty缓存机制 $smarty->display(
Smarty缓存机制 大家应该知道缓存机制能有效的减轻网站的服务器压力,Smarty模板引擎的一大亮点就是为我们提供了非常简单的缓存操作,下面就让我们学习一下。 首先我们要知道Smarty缓存机制分为全局缓存,部分缓存,局部缓存三种,我们一一介绍。 1、全局缓存 顾名思义,全局缓存就是为整个网站的全部页面都生成缓存页面。首先我们要操作smarty的配置文件,开启缓存,指定缓存文件目原创 2016-03-21 10:43:16 · 3447 阅读 · 0 评论 -
Smarty模板中变量修饰格式: {$var|方法1:参数1:参数2…|方法2…}
capitalize [首字母大写] cat :”characters”[连接字符串] count_characters:true/false [计算字符数] count_paragraphs [计算段落数]count_sentences [计算句数]count_words [计算词数]date_format:”%Y-%m-%d” [时间格式]Default:”aaa” [默认]indent[缩进原创 2016-03-21 10:42:26 · 600 阅读 · 0 评论 -
smarty 入门
/** * * @version $Id: index.php * @package * @author www.php100.com * @action 显示实例程序 */ include_once("./Smarty/Smarty.class.php"); //包含smarty类文件 $smarty = new Smarty(); //建立smarty实例对象$smarty $smarty->原创 2016-03-21 10:42:02 · 278 阅读 · 0 评论 -
smarty section循环
{section name = name loop = $varName[, start = $start, step = $step, max = $max, show = true]} name: section的名称,不用加$ $loop: 要循环的变量,在程序中要使用assign对这个变量进行操作。 $start: 开始循环的下标,循环下标默认由0开始 $step原创 2016-03-21 10:42:00 · 429 阅读 · 0 评论 -
smarty中往insert中传参数的方法 .
smarty中往insert中传参数的方法 .smarty中往insert中传参数的方法:smarty里insert方法传参数的方法介绍如下:smarty模板:{insert name="getPara" p1="php" p2="zixue"}php代码:function insert_getPara($arr){return $arr["p1"]." " .$arr["p2"];原创 2016-03-21 10:48:49 · 610 阅读 · 0 评论