PHP - Smarty模板引擎 - Manual手册 - 翻译中 - 第13章 Smarty类方法 - register_function()动态注册模板函数插件
register_function()
register_function() -- 动态注册模板函数插件
Description
描述
void register_function ( string name, mixed impl [, bool cacheable [, mixed cache_attrs]])Pass in the template function name, followed by the PHP function name that implements it.
The php-function callback function can be either:
-
A string containing the function name
-
An array of the form array(&$object, $method) with &$object being a reference to an object and $method being a string containing the method-name
-
An array of the form array($class, $method) with $class being the class name and $method being a method of the class.
cacheable and cache_attrs can be omitted in most cases. See controlling cacheability of plugins output on how to use them properly.
See also unregister_function() and the plugin functions section.
[PHP - Smarty模板引擎 - Manual手册 - 翻译中 - 第13章 Smarty类方法 - register_function()动态注册模板函数插件 - 用途]
实现自定义标记[PHP - Smarty模板引擎 - Manual手册 - 翻译中 - 第13章 Smarty类方法 - register_function()动态注册模板函数插件 - 文档]
http://smarty.php.net/manual/en/api.register.function.php
[PHP - Smarty模板引擎 - 官方网站]
http://smarty.php.net/[PHP - Smarty模板引擎 - 下载地址]
当前版本 2.6.18, http://smarty.php.net/do_download.php?download_file=Smarty-2.6.18.tar.gz
全部列表, http://smarty.php.net/download.php
[PHP - Smarty模板引擎 - 相关论坛]
http://php.board.newsmth.net/http://forum.csdn.net/SList/PHP/
http://www.phpinsider.com/smarty-forum/
http://news.php.net/php.smarty.general
http://news.php.net/php.smarty.dev
http://news.php.net/php.smarty.cvs
[PHP - Smarty模板引擎 - 关键词]
smarty[PHP - Smarty模板引擎 - Manual手册]
借助cycle实现循环输出值, http://smarty.php.net/manual/en/language.function.cycle.php
Smarty的cat函数, http://smarty.php.net/manual/en/language.modifier.cat.php
Smarty的upper函数, http://smarty.php.net/manual/en/language.modifier.upper.php
[PHP - Smarty模板引擎 - Manual手册 - Chapter 3. Basic Syntax第3章 基础语法]
Comments注释, http://smarty.php.net/manual/en/language.basic.syntax.php#language.syntax.commentsMath数学运算, http://smarty.php.net/manual/en/language.math.php
[PHP - Smarty模板引擎 - Manual手册 - Chapter 5. Variable Modifiers第5章 变量修饰符]
cat将值连接到给定变量之后, http://smarty.php.net/manual/en/language.modifier.cat.php
upper将字符串转换成大写字母, http://smarty.php.net/manual/en/language.modifier.upper.php
escape转义修饰符, http://smarty.php.net/manual/en/language.modifier.escape.php
[PHP - Smarty模板引擎 - Manual手册 - Chapter 7. Built-in Functions第7章 内建函数]
{config_load}用于从一个配置文件加载配置变量到模板中, http://www.smarty.net/manual/en/language.builtin.functions.php
{strip}在显示之前删除每行前后多余的空格和回车字符, http://smarty.php.net/manual/en/language.function.strip.php
[PHP - Smarty模板引擎 - Manual手册 - Chapter 8. Custom Functions第8章 自定义函数]
{counter}计数器, http://smarty.php.net/manual/en/language.custom.functions.php
[PHP - Smarty模板引擎 - Manual手册 - 第13章 Smarty类方法]
register_function()动态注册模板函数插件, http://smarty.php.net/manual/en/api.register.function.phpassign_by_ref()按引用赋值, http://smarty.php.net/manual/en/api.assign.by.ref.php