0

感谢burzum帮助使用 CakePHP 配置 TwigView。

我能够在 CakePHP 中使用 .tpl 扩展名。

然而,并非一切都完美无缺。我的 default.tpl 布局文件如下

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    {{ html.charset() }}
    <title>{{ 'CakePHP: the rapid development php framework'|trans }}: {{ title_for_layout }}</title>
    {{ html.meta('icon') }}
    {{ html.css('cake.generic') }}
    {{ scripts_for_layout }}
  </head>
  <body>
    <div id="container">
        <div id="header">
            <h1>{{ 
                html.link('CakePHP: the rapid development php framework'|trans, 'http://cakephp.org')
            }}</h1>
        </div>
        <div id="content">
            {{ session.flash() }}{{ session.flash('auth') }}
            {{ content_for_layout }}
        </div>
        <div id="footer">
        {{ 
            html.image('cake.power.gif', {
                'alt': 'Powered by CakePHP'|trans,
                'url': 'http://cakephp.org'
            })
        }}
        </div>
    </div>
  </body>
</html>

但是,它呈现在下面

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>CakePHP: the rapid development php framework: Testing</title>
  </head>
  <body>
    <div id="container">
        <div id="header">
            <h1></h1>
        </div>
        <div id="content">
            <div class"alert alert-info>Hello There!</div>
        </div>
        <div id="footer">
        </div>
    </div>
  </body>
</html>

助手不渲染。请帮忙!

我上一篇文章的链接在这里

我正在使用主要的 cakephp 插件

4

1 回答 1

0

感谢Alex,问题得到解决。

我从这里的另一篇文章中得到了答案。

我们在控制器中明确声明了助手以使其工作:

public $helpers = array('Html');
于 2013-11-25T04:19:28.477 回答