How to load a template from full path in the template engine TWIG

后端 未结 4 1388
暖寄归人
暖寄归人 2021-01-02 07:20

I\'m wondering how to load a template from it\'s full path (like FILE constant give).

Actually you have to set a \"root\" path for template like thi

4条回答
  •  长发绾君心
    2021-01-02 08:12

    Extend the loader better than modify the library:

    cache[$name])) {
                return $this->cache[$name];
            }
    
            if(is_file($name)) {
                $this->cache[$name] = $name;
                return $name;
            }
    
            return parent::findTemplate($name);
        }
    } 
    

提交回复
热议问题