多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
<table cellspacing="0" cellpadding="0" border="0" width="100%" summary="Header navigation table"><tbody><tr><th align="center" colspan="3">Smarty - the compiling PHPtemplate engine</th> </tr><tr><td valign="bottom" align="left" width="25%"><a accesskey="P" href="api.compileAllConfig.html">Prev</a></td> <td valign="bottom" align="center" width="50%">Chapter 13. Smarty Class Methods()</td> <td valign="bottom" align="right" width="25%"><a accesskey="N" href="api.config.load.html">Next</a></td> </tr></tbody></table> # compileAllTemplates()[编译所有模板] Name compileAllTemplates() ― compiles all known templates 编译所有已知模板 Description string compileAllTemplates(string extension,boolean force, integer timelimit,integer maxerror); This function compiles template files found in the $template_dir folder. It uses the following parameters: extension is an optional string which defines the file extention for the template files. The default is ".tpl". force is an optional boolean which controls if only modified (false) or all (true) templates shall be compiled. The default is "false". timelimit is an optional integer to set a runtime limit in seconds for the compilation process. The default is no limit. maxerror is an optional integer to set an error limit. If more templates failed to compile the function will be aborted. The default is no limit. 本函数将编译在$config_dir目录下找到的模板文件,它有如下参数: “extension”是一个字符串类型的可选项,它定义将编译何种扩展名的模板文件,默认为“.tpl”。 “force”是个布尔型可选项,当为false时只编译修改的模板文件,为true时编译所有模板文件。默认为false。 “timelimit”是个整型可选项,用以设置强制编译的运行时间,单位为秒,默认为不限时间。 “maxerror”是个整型可选项,用以设置最小失败次数,如果过多的模板文件编译失败将终止运行。默认为不限次数。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>Note<br/> This function may not create desired results in all configurations. Use is on own risk.<br/> 本函数可能不会对所有模板文件产生预期效果,风险自担,请注意这点!</td> </tr></table> <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>If any template requires registered plugins, filters or objects you must register all of them before running this function.<br/> 如果需要在模板中注册插件、过滤器、对象,请在运行本函数之前先注册它们。</td> </tr></table> <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>Note<br/> If you are using template inheritance this function will create compiled files of parent templates which will never be used.<br/> 当使用模板继承时,本函数同样会编译父模板,但永远不会用到父的编译模板。</td> </tr></table> <table class="EXAMPLE" cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td> <div class="EXAMPLE"><strong><a name="AEN31312" id="AEN31312"/><span class="PROGRAMLISTING">Example 13.12. compileAllTemplates()</span></strong><b><br/></b><table width="100%" bgcolor="#e0e0e0" border="0"><tbody><tr><td> <pre class="PROGRAMLISTING">&lt;?phpinclude('Smarty.class.php');$smarty = new Smarty;// force compilation of all template files$smarty-&gt;compileAllTemplates('.tpl',true);?&gt;</pre></td> </tr></tbody></table></div> </td> </tr></tbody></table> <table cellspacing="0" cellpadding="0" border="0" width="100%" summary="Footer navigation table"><tbody><tr><td valign="top" align="left" width="33%"><a accesskey="P" href="api.compileAllConfig.html">Prev</a></td> <td valign="top" align="center" width="34%"><a accesskey="H" href="index.html">Home</a></td> <td valign="top" align="right" width="33%"><a accesskey="N" href="api.config.load.html">Next</a></td> </tr><tr><td valign="top" align="left" width="33%">compileAllConfig()<br/> 编译所有配置文件</td> <td valign="top" align="center" width="34%"><a accesskey="U" href="api.functions.html">Up</a></td> <td valign="top" align="right" width="33%">configLoad()<br/> 加载配置</td> </tr></tbody></table>