我已经在我的CakePHP
应用程序中安装了TwigView,我试图在名为default.twig.tpl
的默认模板中加载元素header.twig.tpl
和footer.twig.tpl
。使用CakePHP帮手,TwigView插件无法正常工作
它正常工作与此:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello world!</title>
</head>
<body>
{% element 'header.twig' %}
{{ test_var_from_controller }} <!-- this works and echoes "Hello world!" as expected -->
{% element 'footer.twig' %}
</body>
</html>
,当我尝试使用CakePHP
默认Helpers
的问题开始,他们根本不理。
我不知道为什么,如果我尝试:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello world!</title>
{{ html.css('styes.min') }}
</head>
的方法没有抛出错误被忽略,而该网页还那样工作也从来没有所谓。
我跟着所有的TwigView explanation但它仍然无法正常工作,我错过了什么?
我也想用嫩枝功能,他们似乎不加载某些原因:
{{ 'FOO'|low }}
抛出错误:
Fatal error: Call to undefined function low() in .../app/Plugin/TwigView/tmp/views/2d/4b/65accc...92.php on line 45
show error please? – Anubhav
正如我所说我没有得到错误,他们简直被忽略。 – vitto
我还发现''{dump(method)'{{dump(some_var)}}'没有被twig发现,并且抛出一个错误:''Layouts/default.twig.tpl中不存在函数“dump”在线22' – vitto