内置函数(重要的几个):
<{html_checkboxes name='nation' values=$code output=$name selected=$selid separator='<br />'}>//复选框
<{html_options name='ceshi' options=$xuanxiang selected=$selids}>//下拉列表
<{html_select_date start_year="1990" end_year="2020" month_format="%m" field_order="YMD" field_array="aa"}>//日期
<{html_select_time use_24_hours=true}>//时间
自定义函数:
1、<{jiandan cishu=10 neirong='hello'}>//函数调用
function.jiandan.php //文件
<?php
function smarty_function_jiandan($args)//$args是一个数组,不是可变函数,参数以数组形式传入
{
//1.循环次数 cishu
//2.循环内容 neirong
//array('cishu'=>10,'neirong'=>'hello')
$num = $args["cishu"];
$neirong = $args["neirong"];
$str = "";
for($i=0;$i<$num;$i++)
{
$str = $str.$neirong;
}
return $str;
}

2、块函数--》写法,调用两次,标识
<{biaoji size=24}>    //size是参数
    hello world    //$content
<{/biaoji}>      
block.biaoji.php //文件

<?php
function smarty_block_biaoji($args,$content,$smarty,$bs)
{
//return "aa---{$content}--{$bs}<br>"; 输出页面上试试,标识-->是否是第一次调用
if(!$bs)
{
$size = $args["size"];
$content = "<mark style='font-size:{$size}px'>{$content}</mark>";
return $content;
} }

3、自带控件:
<{textarea name='editer' toolbar='full' height=300 color=red}><{/textarea}>
block.textarea.php
<{color name='color' value='#000000'}>
function.color.php
<{date name='riqi' value='2016-7-24' time=1}>
function.date.php
//自己建相应的文件

 

smarty函数的更多相关文章

  1. Smarty 函数

    html_checkboxes 自定义函数 html_checkboxes 根据给定的数据创建复选按钮组. 该函数可以指定哪些元素被选定. 要么必须指定 values 和 ouput 属性,要么指定 ...

  2. smarty模板配置代码详细说明及如何注册自己的smarty函数

    下面为smarty模板的配置文件,smarty配置的详细说明以及如何注册自己所需要的smarty函数 config.inc.php <?php /** * Smarty 调用 * www.daf ...

  3. smarty函数-转载

    Smarty常用函数 2009-08-13 14:05:55|  分类: Php |举报 |字号 订阅   1 .include_once语句: 引用文件路径,路径必需正确.   eg:include ...

  4. smarty函数-继承extents

    继承<{extends}> {extends}标签用在模版中的第一行: 如果子模板用{extends}标签继承父模板,那么它只能包含{block}标签(内容),其它任何模板内容都将忽略: ...

  5. smarty使用

    smarty-牛刀小试 smarty 初识 官网 http://www.smarty.net/ Smarty is a template engine for PHP(PHP模板引擎) smarty使 ...

  6. 12月15日smarty模板基本语法

    smarty基本语法: 1.注释:<{* this is a comment *}>,注意左右分隔符的写法,要和自己定义的一致. <{* I am a Smarty comment, ...

  7. smarty基本语法

    smarty基本语法: 1.注释:<{* this is a comment *}>,注意左右分隔符的写法,要和自己定义的一致. <{* I am a Smarty comment, ...

  8. Smarty模板学习

    1.基本语法 所有的smarty模板标签都被加上了定界符.默认情况下是 { 和},但它们是可被改变的. 在smarty里,所有定界符以外的内容都是静态输出的,或者称之为不可改变.当smarty遇到了模 ...

  9. Smarty属性

    Attributes [属性] 大多数函数都带有自己的属性以便于明确说明或者修改他们的行为.  smarty函数的属性很像HTML中的属性.  静态数值不需要加引号,但是字符串建议使用引号.  如果用 ...

随机推荐

  1. python学习:猜数字小游戏

    在学习python过程中,没有项目做,就想到哪儿弄到哪儿. 头一发.让机器随机固定一个数字,然后让人去猜. 就这么简单.代码如下: #-*- encoding:utf8 -*- import rand ...

  2. PCA样本数量少于矩阵维数

    %test pcaA=[3,7,1,4,1;5,5,2,1,3;4,2,4,5,3];S=cov(A);T=cov(A');[ds,vs]=eig(S)[dt,vt]=eig(T) 样本数量少于矩阵维 ...

  3. Maven构建项目速度慢问题解决

    Maven项目进行构件的时候速度会很慢,由于maven每次进行创建的时候回去网上下载artheType-catalog.xml文件,而且,现在这个文件比较大,已经接近5M的大小,所以,在网速不好的情况 ...

  4. tensorflow0.8.0 安装配置

    参考官网:https://www.tensorflow.org/  Ubuntu15.10 + Eclipse Mars.2(4.5.2)官网最新 + Anaconda3-4.0.0 + Pydev4 ...

  5. 兼容性所有浏览器的透明CSS设置

    兼容所有浏览器的透明CSS设置: .transparent_class { filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0. ...

  6. UVa 12558 - Egyptian Fractions (HARD version)

    题目大意: 给出一个真分数,把它分解成最少的埃及分数的和.同时给出了k个数,不能作为分母出现,要求解的最小的分数的分母尽量大. 分析: 迭代加深搜索,求埃及分数的基础上,加上禁用限制就可以了.具体可以 ...

  7. iOS学习笔记---oc语言第六天

    Block .数组高级 block本质上就是匿名函数(没有名称的函数) block语法和函数指针很相似 回顾函数 函数:C语⾔中,实现某一类功能的代码段. 完整的函数包含两部分:函数声明.函数定义 函 ...

  8. Android高效加载大图,多图解决方案,有效避免程序OOM异常

    收藏自:http://blog.csdn.net/guolin_blog/article/details/9316683 谷歌官方文档:http://developer.android.com/tra ...

  9. python学习笔记 - assert用法

    [转自]http://blog.sina.com.cn/s/blog_76e94d210100vz37.html   1.assert语句用来声明某个条件是真的. 2.如果你非常确信某个你使用的列表中 ...

  10. 349. Intersection of Two Arrays

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...