Question

I'm using cakePHP 1.3 and have problems with the html-helper.

I want to use autocomplete and therefore I need to load the html-helper in the head of my view (i.g. to load the css). First I followed this tutorial: JQuery autocomplete in CakePHP

but there was the same problem with javascript as it is now with html. Then I tried the new version of the tutorial: CakePHP and jQuery auto-complete revisited

I know the new tutorial was written for CakePHP 2.3 but I read that the functionality for jQuery should be the same for CakePHP 1.3.

So the header of my view looks like this:

<?php
  echo $this->Html->css('https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css'); ?>

But this throws the following error:

Notice (8): Undefined property: View::$Html [APP\views\produkt\show.ctp, line 5] Fatal error: Call to a member function css() on a non-object

In any case (css, jquery, ...) this error occurs. So it seems to me that the problem belongs to the helper. Also if I use the script-method.

The html-helper exists in my cake/libs/views/helpers folder. Also I load it in the produkt_controller:

class ProduktController extends AppController {
var $helpers = array (
        'Html',
        'Check',
        'Misc'
);

I have already searched here for a solution, but found no answer that fits for me. Sadly the link to cakePHP mentioned in this post how to include javascript in cakephp 1.3? is somehow broken and I didn't found an answer to my problem in the cookbook for cakePHP 1.3.

Please, if someone could help me to get the helper running, that would be great!

Était-ce utile?

La solution

In 1.3 it is

$html->methodName()

while in 2.0 it became

$this->Html->methodName()

Why are you reading the documentation for 2.0? The documentation for 1.3 is still up.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top