Friday, April 1, 2011

Problem calling private method

Hello,

I have a header element that I want to display either a login form or
a control panel depending on whether or not the user is logged in.

... in my header element: ...

$user = $this->requestAction('users/getUser');
if (empty($user)) { // login form }
else { // control panel }

...and in my controller...

function _getUser() {

if ($this->Session->read('Auth.User')) { return $this->Auth-
>user(); }
else { return false; }

}

The problem is that I don't want someone to be able to type /users/
getUser. Therefore, I tried making it private (_getUser). When I do
so, I get a nested error in which the entire header is repeating
itself infinitely. I have no idea why.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate