4 * Smarty Method MustCompile
6 * Smarty_Internal_Template::mustCompile() method
9 * @subpackage PluginsInternal
12 class Smarty_Internal_Method_MustCompile
15 * Valid for template object
22 * Returns if the current template must be compiled by the Smarty compiler
23 * It does compare the timestamps of template source and the compiled templates and checks the force compile
26 * @param \Smarty_Internal_Template $_template
29 * @throws \SmartyException
31 public function mustCompile(Smarty_Internal_Template $_template)
33 if (!$_template->source->exists) {
34 if ($_template->_isSubTpl()) {
35 $parent_resource = " in '$_template->parent->template_resource}'";
37 $parent_resource = '';
39 throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
41 if ($_template->mustCompile === null) {
42 $_template->mustCompile = (!$_template->source->handler->uncompiled &&
43 ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
44 !$_template->compiled->exists || ($_template->smarty->compile_check &&
45 $_template->compiled->getTimeStamp() <
46 $_template->source->getTimeStamp())));
49 return $_template->mustCompile;