Smarty 函数】的更多相关文章

html_checkboxes 自定义函数 html_checkboxes 根据给定的数据创建复选按钮组. 该函数可以指定哪些元素被选定. 要么必须指定 values 和 ouput 属性,要么指定 options 替代. 所有的输出与 XHTML 兼容 html_checkbox用来用给定的数据创建checkbox.name表示checkbox的名称,values表示checkbox的值,output表示checkbox的显示,selected表示被选选项的值,options表示一组check…
下面为smarty模板的配置文件,smarty配置的详细说明以及如何注册自己所需要的smarty函数 config.inc.php <?php /** * Smarty 调用 * www.dafei.net */ /*** 新建 Smarty 对象 */ require_once (dirname(__FILE__).'/Smarty/libs/Smarty.class.php'); $smarty = new Smarty; //$Smarty->caching = true; //决定是否…
内置函数(重要的几个): <{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" en…
Smarty常用函数 2009-08-13 14:05:55|  分类: Php |举报 |字号 订阅   1 .include_once语句: 引用文件路径,路径必需正确.   eg:include_once("smarty/Smarty.class.php"); 2 $smarty=new Smarty(); 新建一个对象smarty, 实例化一个对象. 3 $smarty->template_dir=“”: 指定$smarty对象使用的tpl模板的路径,它是一个目录,默认目…
继承<{extends}> {extends}标签用在模版中的第一行: 如果子模板用{extends}标签继承父模板,那么它只能包含{block}标签(内容),其它任何模板内容都将忽略: 后台(zi.php) <?php include("../init.inc.php"); include("../DBDA.php"); $db = new DBDA(); $smarty->assign("shouye","首…
smarty-牛刀小试 smarty 初识 官网 http://www.smarty.net/ Smarty is a template engine for PHP(PHP模板引擎) smarty使用: index.php <?php date_default_timezone_set("PRC");//PRC为"中华人民共和国" require ('../smarty/Smarty.class.php'); $smarty = new Smarty();…
smarty基本语法: 1.注释:<{* this is a comment *}>,注意左右分隔符的写法,要和自己定义的一致. <{* I am a Smarty comment, I don't exist in the compiled output *}><!--里面的内容是注释的,不会显示在页面中--> 2.变量:模板变量用美元符号$开始,可以包含数字.字母和下划线,这与php变量很像.可以引用数组的数字或非数字索引,当然也可以引用对象属性和方法. <{…
smarty基本语法: 1.注释:<{* this is a comment *}>,注意左右分隔符的写法,要和自己定义的一致. <{* I am a Smarty comment, I don't exist in the compiled output *}><!--里面的内容是注释的,不会显示在页面中--> 2.变量:模板变量用美元符号$开始,可以包含数字.字母和下划线,这与php变量很像.可以引用数组的数字或非数字索引,当然也可以引用对象属性和方法. <{…
1.基本语法 所有的smarty模板标签都被加上了定界符.默认情况下是 { 和},但它们是可被改变的. 在smarty里,所有定界符以外的内容都是静态输出的,或者称之为不可改变.当smarty遇到了模板标签,将尝试解释他们,然后再以恰当的方式输出 . 2.注释 模板注释被*号包围,例如 {* this is a comment *} smarty注释不会在模板文件的最后输出中出现.它只是模板内在的注释. 3.函数 每一个smarty标签输出一个变量或者调用某种函数.在定界符内函数和其属性将被处理…
Attributes [属性] 大多数函数都带有自己的属性以便于明确说明或者修改他们的行为.  smarty函数的属性很像HTML中的属性.  静态数值不需要加引号,但是字符串建议使用引号.  如果用变量作属性,它们也不能加引号. 一些属性用到了布尔值(真或假). 它们不需要加引号,可以是true,on,yes或者false,off,no. 例 3-3.函数属性语法   {include file="header.tpl"} {include file=$includeFile} {i…