【问题标题】:Cake PHP: HTML Helper inside Element does not workCake PHP:Element 中的 HTML Helper 不起作用
【发布时间】:2013-10-14 19:24:59
【问题描述】:

我进行如下调用: $this->element('stories') 以便在多个页面中显示这个名为“stories”的元素的内容。当我在元素内使用 html 帮助程序时,我收到以下错误:Missing Helper Error: htmlHelper could not be found.

注意:我使用的是 CakePHP 2.4

谢谢

【问题讨论】:

  • 您确定在所有控制器中都启用了 Htmlhelper 吗?另外:HtmlHelper 大写“H”
  • 是的,请注意您的外壳 - 几乎所有与编程和操作系统相关的东西(即使您来自 Windows^^)。

标签: php html cakephp helper


【解决方案1】:

你可以使用 html helper like..

<?php 
   // not echo $html->link('text', 'url'); 
   // not echo $this->html->link('text', 'url'); 
   echo $this->Html->link('text', 'url'); 
?>

请检查您的代码。请查看documentation

【讨论】:

  • 另外,别忘了echo
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-01-02
  • 1970-01-01
  • 2010-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-20
相关资源
最近更新 更多