本文整理汇总了PHP中Twig_Environment::clearCacheFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Environment::clearCacheFiles方法的具体用法?PHP Twig_Environment::clearCacheFiles怎么用?PHP Twig_Environment::clearCacheFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::clearCacheFiles方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($name, array $values = array())
{
if (defined('ENV_DEV')) {
$this->engine->clearCacheFiles();
$this->engine->clearTemplateCache();
}
return $this->engine->render($name . $this->suffix, $values);
}
示例2: initTemplateEngine
/**
* Initialise Twig
*
* @return void
*/
protected function initTemplateEngine()
{
$this->loader = new \Twig_Loader_Filesystem($this->getTemplateDir());
$this->twig = new \Twig_Environment($this->loader, array('cache' => $this->cacheDir));
if ($this->isDev) {
$this->twig->clearCacheFiles();
}
}
示例3: clear_cache
/**
* Clear the cache
*
* @return \phpbb\template\template
*/
public function clear_cache()
{
if (is_dir($this->cachepath)) {
$this->twig->clearCacheFiles();
}
return $this;
}
示例4: render
/**
* sends content to the browser
*/
function render($string, $template_vars = array())
{
$loader = new \Twig_Loader_Filesystem($this->templates);
$twig = new \Twig_Environment($loader, array('cache' => __ROOT__ . '/cache/twig'));
if (__DEV__) {
$twig->clearCacheFiles();
}
echo $twig->render($string, $template_vars);
}
示例5: getTwig
/**
* @param $rootDir
* @param $loader
* @return Twig_Environment
*/
protected function getTwig($rootDir, $loader)
{
$twig = new Twig_Environment($loader, array('cache' => $rootDir . '/cache/'));
$twig->clearCacheFiles();
$f = new Twig_SimpleFunction("querify", function ($data) {
$string = array();
foreach ($data as $d) {
$string[] = urlencode($d->key) . "=" . urlencode($d->value);
}
return implode("&", $string);
});
$twig->addFunction("querify", $f);
$f = new Twig_SimpleFunction("prettify", function ($data) {
return json_encode(json_decode($data), JSON_PRETTY_PRINT);
});
$twig->addFunction("prettify", $f);
return $twig;
}
示例6: Crawler
*/
include_once '../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\DomCrawler\Crawler;
use Evista\Perform\Service;
use Evista\Perform\Exception\FormFieldException;
date_default_timezone_set('Europe/Budapest');
$router = new League\Route\RouteCollection();
$loader = new Twig_Loader_Filesystem('../src/views');
$crawler = new Crawler();
// Initialize form transpilation service (dependency injection friendly interface)
$formService = new Service($crawler, '../var/uploads');
$twig = new Twig_Environment($loader, array('cache' => '../var/cache'));
$twig->clearCacheFiles();
$router->addRoute('GET', '/', function (Request $request, Response $response) use($twig) {
// do something clever
$response = new Response($twig->render('form.twig.html', []));
return $response;
});
$router->addRoute('POST', '/displayform', function (Request $request, Response $response) use($twig, $crawler, $formService) {
$formMarkup = $request->request->get('serform');
$form = $formService->transpileForm($formMarkup);
// Dump the object
$response = new JsonResponse(['dump' => var_export($form, true)]);
return $response;
});
// Use form data
$router->addRoute('POST', '/multiple-file-uploads', function (Request $request, Response $response) use($twig, $crawler, $formService) {
$formMarkup = urldecode($request->request->get('serform'));
示例7: clearCacheFiles
/**
* Очистка кеша шаблонов
*/
public static function clearCacheFiles()
{
self::$twigEnvironment->clearCacheFiles();
}
示例8: clearCacheFiles
/**
* [clearCacheFiles description]
* @return [type] [description]
*/
public function clearCacheFiles()
{
$this->twig->clearCacheFiles();
}
示例9: clearCache
/**
* @return void
*/
public function clearCache()
{
$E = new \Twig_Environment(null, array('cache' => realpath(__DIR__ . self::$Cache)));
$E->clearCacheFiles();
$E->clearTemplateCache();
}
示例10: reset
/**
* {@inheritdoc}
*/
public function reset()
{
$this->twig->clearCacheFiles();
$this->twig->clearTemplateCache();
}