>
> Hi all, I am new to cakephp. Maybe this problem is simple, but please
> help me. I have a hotels_controller.php:
>
> <?php
> class HotelsController extends AppController {
> var $scaffold;
>
> var $helpers = array("Javascript");
>
> function index() {
>
> }
> }
> ?>
>
> and in the /app/views/layouts/default.ctp, there is
>
> <?php echo $javascript->link("main"); ?>
>
> and there is an empty view /app/views/hotels/index.ctp
>
> but I get error msg:
>
> Notice (8): Undefined variable: javascript [APP\views\layouts
> \default.ctp, line 1581]
This is because the controller's $helpers were not loaded. See below:
> Code | Context
>
> $___viewFn = "E:\xampp\htdocs\booking\app\views\layouts\default.ctp"
> $___dataForView = array(
> "controller" => "HotelController",
> "controllerName" => "Hotel",
> "title_for_layout" => "Missing Controller",
> "content_for_layout" => "<h2>Missing Controller</h2>
> <p class="error">
> <strong>Error: </strong>
> <em>HotelController</em> could not be found.</p>
> <p class="error">
> <strong>Error: </strong>
> Create the class <em>HotelController</em> below in file: app
> \controllers\hotel_controller.php</p>
> <pre>
> <?php
> class HotelController extends AppController {
>
> var $name = 'Hotel';
> }
> ?>
> </pre>
Cake is looking for a class named HotelController, but you have a
HotelsController. The latter is the "correct" naming convention,
though. So, it's possible that you have an incorrect route. What's the
URL you're using to get to this page, and do you have a route for it?
Also, do you really have more than 1581 lines in your default
layout?!? I'm wondering if that's a Cake boo-boo.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment