Add cache to twig templates

This commit is contained in:
Eric
2020-06-05 15:51:30 +02:00
parent a858362622
commit 0b84e809f6

View File

@@ -22,6 +22,10 @@ class TwigHelper
$oLoader = new Twig_Loader_Filesystem($sViewPath);
$oTwig = new Twig_Environment($oLoader);
Extension::RegisterTwigExtensions($oTwig);
$sLocalPath = utils::LocalPath($sViewPath);
$sLocalPath = str_replace('env-'.utils::GetCurrentEnvironment(), 'twig', $sLocalPath);
$sCachePath = utils::GetCachePath().$sLocalPath;
$oTwig->setCache($sCachePath);
return $oTwig;
}