本文整理汇总了PHP中Twig_Environment::setAutoReload方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Environment::setAutoReload方法的具体用法?PHP Twig_Environment::setAutoReload怎么用?PHP Twig_Environment::setAutoReload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::setAutoReload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* Loads the Twig instance and registers the autoloader.
*/
public function configure()
{
parent::configure();
$this->configuration = $this->context->getConfiguration();
// template name
$template = sfConfig::get('sf_template');
$templateDir = sfConfig::get('sf_template_dir') . '/' . $template;
if (!file_exists($templateDir)) {
throw new sfException(__METHOD__ . ": Couldn't find template " . $template);
}
// decorator template path
$layoutTemplateDir = $templateDir . '/global';
if (is_readable($layoutTemplateDir . '/' . $this->getDecoratorTemplate())) {
$this->setDecoratorDirectory($layoutTemplateDir);
}
// module template path
$moduleTemplateDir = $templateDir . '/modules/' . $this->moduleName;
if (is_readable($moduleTemplateDir . '/' . $this->getTemplate())) {
$this->setDirectory($moduleTemplateDir);
}
// init twig engine
// empty array becuase it changes based on the rendering context
$this->loader = new Twig_Loader_Filesystem(array());
$this->twig = new sfTwigEnvironment($this->loader, array('cache' => sfConfig::get('sf_template_cache_dir') . '/' . $template, 'debug' => sfConfig::get('sf_debug', false), 'sf_context' => $this->context));
if ($this->twig->isDebug()) {
$this->twig->setAutoReload(true);
}
$this->loadExtensions();
}
示例2: configure
/**
* Loads the Twig instance and registers the autoloader.
*
* @return void
*/
public function configure()
{
parent::configure();
$this->configuration = $this->context->getConfiguration();
//Empty array becuase it changes based on the rendering context
$this->loader = new Twig_Loader_Filesystem(array());
$this->twig = new Twig_Environment($this->loader, array('cache' => sfConfig::get('sf_template_cache_dir'), 'debug' => sfConfig::get('sf_debug', false)));
if ($this->twig->isDebug()) {
$this->twig->setCache(null);
$this->twig->setAutoReload(true);
}
$this->loadExtensions();
}