【发布时间】:2014-03-04 16:30:48
【问题描述】:
我使用的是 cakePHP 1.3,但遇到了 html-helper 的问题。
我想使用自动完成功能,因此我需要在我的视图头部加载 html-helper(例如加载 css)。首先我跟着这个教程:JQuery autocomplete in CakePHP
但是 javascript 和现在的 html 存在同样的问题。然后我尝试了新版教程:CakePHP and jQuery auto-complete revisited
我知道新教程是为 CakePHP 2.3 编写的,但我读到 jQuery 的功能应该与 CakePHP 1.3 相同。
所以我的视图的标题看起来像这样:
<?php
echo $this->Html->css('https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css'); ?>
但这会引发以下错误:
注意(8):未定义属性:View::$Html [APP\views\produkt\show.ctp,第 5 行] 致命错误:调用成员 非对象上的函数 css()
在任何情况下(css、jquery、...)都会发生此错误。所以在我看来,问题属于助手。另外,如果我使用脚本方法。
html-helper 存在于我的 cake/libs/views/helpers 文件夹中。我也将它加载到 produkt_controller 中:
class ProduktController extends AppController {
var $helpers = array (
'Html',
'Check',
'Misc'
);
我已经在这里搜索过解决方案,但没有找到适合我的答案。遗憾的是,这篇文章how to include javascript in cakephp 1.3? 中提到的 cakePHP 链接不知何故被破坏了,我在 cakePHP 1.3 的食谱中没有找到我的问题的答案。
拜托,如果有人可以帮助我让助手运行,那就太好了!
【问题讨论】:
标签: jquery cakephp undefined cakephp-1.3 helpers