Notice (8): Undefined property: UsersController::$User [CORE/app/
controllers/users_controller.php, line 89]
if(empty($this->data) == false)
{
#print_r($this);
if(($user = $this->User->validateLogin($this-
>data['User'])) == true)
{
UsersController::login() - CORE/app/controllers/users_controller.php,
line 89
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 341
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 323
[main] - CORE/app/webroot/index.php, line 83
Fatal error: Call to a member function validateLogin() on a non-object
in /var/www/cake/app/controllers/users_controller.php on line 89
See, its saying User is a non-object. If i remove the part at the top
of my user_controller that says $uses=array("NavigationData")
then i can login to the system..
<?php
class NavigationData extends AppModel
{
var $useTable = false;
var $name = "NavigationData";
var $validate = array();
var $allLinks = array(
"about"=>array("href"=>"/pages/about", "text"=>"About"),
"signup"=>array("href"=>"/users/signup", "text"=>"Sign
Up"),
"index"=>array("href"=>"/users/index", "text"=>"Energy
Usage"),
"profile"=>array("href"=>"/users/profile",
"text"=>"Profile"),
"payments"=>array("href"=>"/users/payments",
"text"=>"Payments")
);
var $links = array();
function setLinks($arrKeys) {
foreach ($arrKeys as $key) {
if (array_key_exists($key, $this->allLinks)) {
$this->links[$key] = $this->allLinks[$key];
}
}
}
function getLinks() {
return $this->links;
}
}
basically what i want to do is in my controller, i have a
validate_login function that runs from before_filter
if a user is logged in i want to set the links to
array("profile", "payments", ....etc) which correspond to the
NavigationData keys with the same names
Then this way i can put in my default template an nav_for_layout
variable which i just have to make sure to set in all my controllers
(which is easy if i do it in a before filter). I'm trying to avoid
having to put the navigation in each and every individual view page as
that would be highly redundant.
Yet in the cake manual they say to use an element which i believe
would have to be put in regular views and wouldnt work in the default
template, or would it? Oh, and i created a navigation helper to
convert the links into an unordered list.. but thats not the issue yet
as i havent added it to the helpers array yet.
On Jun 22, 12:12 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> You need to be more specific with the problems you are having. Please
> post the error messages, and the code that causes them to appear.
>
> > Surely someone has actually used a model without a table before..
>
> Yes, plenty of people, and "var $useTable = false" is all you need.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---