内置函数(重要的几个):
<{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. [转]SQLITE3 C语言接口 API 函数简介

    SQLITE3 C语言接口 API 函数简介 说明:本说明文档属作者从接触 SQLite 开始认识的 API 函数的使用方法, 由本人翻译, 不断更新. /* 2012-05-25 */ int sq ...

  2. Android 常见的广播 action常量

    Intent.ACTION_AIRPLANE_MODE_CHANGED; //关闭或打开飞行模式时的广播 Intent.ACTION_BATTERY_CHANGED; //充电状态,或者电池的电量发生 ...

  3. Link Aggregation and LACP with Open vSwitch

    In this post, I’m going to show you how to use link aggregation (via the Link Aggregation Control Pr ...

  4. Think Python - Chapter 15 - Classes and objects

    15.1 User-defined typesWe have used many of Python’s built-in types; now we are going to define a ne ...

  5. Linux ---pptpd部署

    PPTP 全称为 Point to Point Tunneling Protocol -- 点到点隧道协议,是VPN协议中的一种. 一.CentOS 6.2 下 PPTP VPN 服务器安装 1.安装 ...

  6. 标准盒模型与ie盒模型

    ff(标准的盒模型) Box的宽高包括 padding .border.margin.content区域 ie Box的宽度包括  margin  content区域(content区域包含paddi ...

  7. CDH hadoop的安装

    1 先拷贝tar包到目录底下(tar 包解压 tar zxvf) 2 : 1.使用课程提供的hadoop-2.5.0-cdh5.3.6.tar.gz,上传到虚拟机的/usr/local目录下.(htt ...

  8. 课堂所讲整理:输入输出流(I/O)

    package org.hanqi.ex; import java.io.*; public class TestFile { public static void main(String[] arg ...

  9. C++中this指针的用法详解(转)

    原文地址:http://blog.chinaunix.net/uid-21411227-id-1826942.html 1. this指针的用处: 一个对象的this指针并不是对象本身的一部分,不会影 ...

  10. GDI+中GIF图片的显示

    某位网友曾经问过我GDI+中Gif图像显示的问题,一直没时间给你写,在此致歉.我把这篇文章送给他. 一.GIF格式介绍 1.概述 GIF(Graphics Interchange Format,图形交 ...