Again, this approach is not correct.
Checking for user status, should always be done in the controller.

Take a look at the auth component in the manual to see how you can
restrict access to certain resources/pages.


On Sep 23, 2:14 pm, "Gabriel Kolbe" <[EMAIL PROTECTED]> wrote:
> Sorry, just to add to the info below, the view DOES not have a
> controller or a model, not I don't want to place it in the
> app_controller, because some page accessable even if you are not
> logged in.. my problem is I am unexperienced and it is mega
> frastrating !!
>
> On Tue, Sep 23, 2008 at 7:09 PM, Gabriel Kolbe <[EMAIL PROTECTED]> wrote:
> > Hi, my situation is the following:
> > // check if user is logged in...
> > <? if ($session->check('Auth.User.id')) { ?>
> > do your thing
> >  <? } else { ?>
> > redirect page somewhere else
> > <?
> > }
> > ?>
> > is is done in a view how, do you mean I have to check the login in the
> > function in the controller ?
>
> > Regards
>
> > On Tue, Sep 23, 2008 at 4:34 PM, dr. Hannibal Lecter
> > <[EMAIL PROTECTED]> wrote:
>
> >> Hi again,
>
> >> as teknoid said, don't redirect from a view.
>
> >> If you've come to a point where you redirect from a view, you should
> >> seriously reconsider you coding strategy. Views are supposed to
> >> display data, define the look of your app and input forms; but never
> >> handle any business or application logic.
>
> >> The name itself implies it - view ;)
>
> >> On Sep 23, 4:53 pm, "Gabriel Kolbe" <[EMAIL PROTECTED]> wrote:
> >>> Hi doc
>
> >>> Thanks for the reply, but how do I redirect in a view which does not
> >>> have a model or controller?
>
> >>> On Tue, Sep 23, 2008 at 1:26 PM, dr. Hannibal Lecter
>
> >>> <[EMAIL PROTECTED]> wrote:
>
> >>> > Of course, why not :)
>
> >>> >http://api.cakephp.org/class_controller.html#903188d3de83bd65c78bb676...
>
> >>> > On Sep 23, 2:00 pm, gabriel <[EMAIL PROTECTED]> wrote:
> >>> >> Wouldn't it be great if cake adds a straight PHP equivalent on it's
> >>> >> manual pages, for instance I want to redirect a page in straight PHP
> >>> >> it would be '  header("Location: index.php"); '  does any one know how
> >>> >> to do this in CAKE ?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to