14 $loader=new \Twig_Loader_Filesystem(ROOT . DS .
"views/");
15 if(isset($options[
"cache"]) && $options[
"cache"]===
true)
16 $options[
"cache"]=ROOT.DS.CacheManager::getCacheDirectory().DS.
"views/";
17 $this->twig=new \Twig_Environment($loader, $options);
19 $function=new \Twig_SimpleFunction(
'path',
function ($name,$params=[],$absolute=
false) {
22 $this->twig->addFunction($function);
23 $function=new \Twig_SimpleFunction(
'url',
function ($name,$params) {
26 $this->twig->addFunction($function);
27 $this->twig->addGlobal(
"app",
new Framework());
34 public function render($viewName, $pData, $asString) {
36 $render=$this->twig->render($viewName, $pData);
static url($name, $parameters=[])
Returns the generated url from a route.
__construct($options=array())
render($viewName, $pData, $asString)
static path($name, $parameters=[], $absolute=false)
Returns the generated path from a route.