我已經在我的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