Get Smarty

Donate

Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

Name

compileAllTemplates() — 编译全部模板

说明

string compileAllTemplates(string extension,
                           boolean force,
                           integer timelimit,
                           integer maxerror);

该函数将编译$template_dir目录下的模板文件。 参数如下:

  • extension 字符串,指定模板文件的后缀名。默认为“.tpl”。

  • force 布尔值。设定是否仅编译已修改的模板文件(false)或强制编译全部模板文件(true)。默认是false。

  • timelimit 整型,设定模板编译过程的时间限制。默认是无限制。

  • maxerror 整型,设定编译过程中出现的最大错误次数,超过此次数将停止编译。默认是无限制。

Note

该函数有可能不会生成全部预期的编译结果,所以使用会有一定风险。

Note

如模板需要注册插件、过滤器或对象等,在执行该函数之前必须先注册这些东西。

Note

如果使用模板继承,那么该函数将编译产生父模板的编译文件,但这些编译文件将永远也不会被使用到。

Example 14.15. compileAllTemplates()


<?php
include('Smarty.class.php');
$smarty = new Smarty;

// 强制编译全部模板
$smarty->compileAllTemplates('.tpl',true);

?>

    


Comments
No comments for this page.

Advertisement

Sponsors [info]

Sponsors