15 $loader=new \Twig_Loader_Filesystem(ROOT . DS .
"views/");
17 if(isset($options[
"cache"]) && $options[
"cache"]===
true)
18 $options[
"cache"]=ROOT.DS.CacheManager::getCacheDirectory().DS.
"views/";
19 $this->twig=new \Twig_Environment($loader, $options);
21 $function=new \Twig_SimpleFunction(
'path',
function ($name,$params=[],$absolute=
false) {
24 $this->twig->addFunction($function);
25 $function=new \Twig_SimpleFunction(
'url',
function ($name,$params) {
28 $this->twig->addFunction($function);
29 $this->twig->addGlobal(
"app",
new Framework());
36 public function render($viewName, $pData, $asString) {
38 $render=$this->twig->render($viewName, $pData);
46 return $this->twig->load($templateName)->getBlockNames();
50 return UFileSystem::load($this->twig->load($templateName)->getSourceContext()->getPath());
static url($name, $parameters=[])
Returns the generated url from a route.
__construct($options=array())
render($viewName, $pData, $asString)
getBlockNames($templateName)
static path($name, $parameters=[], $absolute=false)
Returns the generated path from a route.