<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><th colspan="3" align="center">Smarty - the compiling PHP template engine</th></tr><tr><td width="25%" align="left" valign="bottom"><a href="template.resources.html" accesskey="P">Prev</a></td><td width="50%" align="center" valign="bottom"/><td width="25%" align="right" valign="bottom"><a href="plugins.naming.conventions.html" accesskey="N">Next</a></td></tr></table> # Chapter 16. Extending Smarty With Plugins第十六章.以插件扩展Smarty **Table of Contents**[How Plugins Work](#) 插件如何工作[Naming Conventions](#) 命名约定[Writing Plugins](#) 编写插件[Template Functions](#) 模板函数插件[Modifiers](#) 调节器[Block Functions](#) 块函数插件[Compiler Functions](#) 编译函数插件[Prefilters/Postfilters](#) 预滤器/后滤器插件[Output Filters](#) 输出过滤器插件[Resources](#) 资源插件[Inserts](#) 嵌入插件 Version 2.0 introduced the plugin architecture that is used for almost all the customizable functionality of Smarty. This includes: With the exception of resources, backwards compatibility with the old way of registering handler functions via register_* API is preserved. If you did not use the API but instead modified the class variables $custom_funcs, $custom_mods, and other ones directly, then you will need to adjust your scripts to either use the API or convert your custom functionality into plugins. 2.0版本引入了被广泛应用于自定义Smarty函数功能的插件架构。它包括如下类型: - functions 函数插件 - modifiers 调节器插件 - block functions 块函数插件 - compiler functions 编译函数插件 - prefilters 预滤器插件 - postfilters 后滤器插件 - outputfilters 输出过滤器插件 - resources 资源插件 - inserts 嵌入插件 除资源插件外,插件架构向后兼容了通过register_* API注册处理函数的方式。如果你不用API,而是使用直接修改类变量$custom_funcs、$custom_mods等的方法,那么你就需要修改你的程序了。或者使用API的方法,或者将你的自定义函数转换成插件。 译注 | 上述register_* API函数,应是register* API函数,因为从3.0版本以后Smarty改用了驼峰式类方法的命名方式,unregister_* API函数也属这类。以下不赘述。 | |-----| <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="template.resources.html" accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="plugins.naming.conventions.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Resources<br/> [资源] </td><td width="34%" align="center" valign="top"><a href="smarty.for.programmers.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Naming Conventions<br/> 命名约定</td></tr></table>