Re: redirect from within a view
Yes, just remember to invoke the parent::beforeFilter method of the
parent controller :)
Enjoy,
John
On Jan 3, 7:10 pm, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> You mean in the pages controller? Is it overridable?
>
>
>
> John Andersen wrote:
> > As is specified in your router connect statement, it uses the pages
> > controller in order to display the admin view.
> > If you are not using the pages controller to display other pages/
> > views, then add your check in the beforeFilter method (or create it)
> > in the controller.
> > Enjoy,
> > John
>
> > On Jan 3, 4:32 pm, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> >> I have this setting in the route
>
> >> Router::connect('/admin/', array('controller' => 'pages', 'action' =>
> >> 'display', 'admin'));
>
> >> so that it directly displays the admin.ctp, and I thought it doesn't
> >> pass by a controller of mine, am I wrong?
>
> >> cheers
> >> Lorenzo
>
> >> John Andersen wrote:
> >>> There is a controller associated with the route, probably it is called
> >>> index!
> >>> Your view is invoked by the controller, so which controller are you
> >>> using for the admin?
> >>> Please someone else correct me, if I am wrong about this! As far as I
> >>> know, you can't invoke a view, just by having a route - it has to go
> >>> through a controller!
> >>> Enjoy,
> >>> John
> >>> On Jan 3, 12:40 pm, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> >>>> well that was a view linked directly by the router, e.g.,
> >>>> /admin
> >>>> thus there's no controller action associated to that...
> >>>> Lorenzo
> >>>> John Andersen wrote:
> >>>>> Make the check in the controller and do the redirect from there!
> >>>>> Enjoy,
> >>>>> John
> >>>>> On Jan 2, 7:01 pm, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> >>>>>> Hi
> >>>>>> is there a way to perform a redirect from inside a view?
> >>>>>> For instance if the user is not logged.
> >>>>>> I can do this manually like this:
> >>>>>> <?php
> >>>>>> if (!$session->check('User')) {
> >>>>>> header ("Location: ".$html->url('/'));}
> >>>>>> ?>
> >>>>>> but I was wondering if there was a more "cake" way to do this.
> >>>>>> thanks in advance
> >>>>>> Lorenzo
> >>>> --
> >>>> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> >>>> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> >>>> BLOGS:http://tronprog.blogspot.comhttp://longlivemusic.blogspot.com
> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions.
> >>> 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 athttp://groups.google.com/group/cake-php?hl=en
> >> --
> >> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> >> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> >> BLOGS:http://tronprog.blogspot.comhttp://longlivemusic.blogspot.com
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> > 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 athttp://groups.google.com/group/cake-php?hl=en
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home