本文整理匯總了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();
}