yes, there is actually a pretty easy way to do this, and the location of the
code depends on where you want it applied.

In my own site, I have 2 separate layouts, one for logged in users, one for
non-logged in users. in my app_controller.php file, I have the following
code set up in the beforeFilter function.

$this->layout = (logged in or not logic here)?'game':'default';

you can also place this logic in the beforeFilter function of any one of
your controllers for more flexibility. $this->layout = 'choose layout here'
will let you change the layout in any function in any controller.

On Feb 13, 2008 6:46 PM, the_woodsman <[EMAIL PROTECTED]> wrote:

>
> Sounds like you're looking for the controller's render() method.
>
> It's always good to check the manual (http://manual.cakephp.org/
> chapter/controllers) or the API (http://api.cakephp.org/
> class_controller.html) first :)
>
>
> On Feb 13, 10:53 pm, subnet <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > is there any way to set an alternate view(-template) inside a
> > controller?
> >
> > f.e.
> >
> > class UsersController extends AppController
> > {
> >   function login() {
> >     if (...)
> >        // default: render with view login.thtml
> >     else
> >       // render with a different view, f.e. login_error.thtml
> >
> > }
> >
> > thx,
> > michael
> >
>


-- 
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s+: a20 C++++ UL++ P L++
!E W++ N(-) o? K? w(+) O? M-- V?
PS+ PE Y- PGP- t+ 5? X- R tv--
b++ Di D+ G+ e h! r y-
------END GEEK CODE BLOCK------

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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