smarty的自定义函数

来源:互联网 发布:minecraft 编程 编辑:程序博客网 时间:2024/05/30 22:56
 

Smarty函数

  实现对smarty的功能扩展

  Smarty.class.php

   内建函数:smarty自带,不能呢过修改

   自定义函数:可以自行修改

                保存在plugins目录下

                语法格式类似于html标记的写法

                <{...........}>

一、了解smarty自定义函数

      例如:

          1smarty 自定义函数assign

             函数名称:assign

             参数:var:声明变量名称  字符串

                  Value: 给该变量赋值  字符串

           <{assign  var="title"  value="this is title"}>

                 $tpl->assign("title","this is title");

           <input type="text" name="input1">

           属性无顺序要求

           <{config_load file="*.conf" section="one"}>

          2)smarty 方法 assign

   

二、实现自定义函数

    例如:a.html

     <{title  num="10"  content="aaaaa"   size=   clolor=  }>

     B.php

原创粉丝点击