Why certainly! In your AppController add this:

function beforeFilter() {
    if (!empty($this->params['facebook'])) {
        $this->viewPath = 'fbml';
    }
}

And then you would have your fbml view in:

app/views/YourModel/fbml/index.ctp

and then you put your xhtml view in:

app/views/YourModel/index.ctp

Cheers,
Adam

----- Original Message ----- 
From: "Greg Baker" <[email protected]>
To: "CakePHP" <[email protected]>
Sent: Wednesday, June 17, 2009 8:21 PM
Subject: Changing view file in controller


>
> Is it possible to change the view file easily in the AppController?
> Basically I want to check $this->params['facebook'] and if it exists I
> want the view to render to be, say fbindex.ctp instead of
> index.ctp...or fbadd.ctp instead of add.ctp.  I want to do this
> because the facebook pages contains fbml while the other pages contain
> xhtml.
>
> I know I can do this in every action in my controllers by using $this-
>>render('fbindex')....but is there a more elegant solution?  Perhaps
> adding something to AppController::beforeRender() ?
> >
>
> 


--~--~---------~--~----~------------~-------~--~----~
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