Render View Outside Controller

Hi Guys

I have a simple question but can’t seem to wrap my head around it.

I have an Agent controller and a Adverts controller and in adverts views I use a different theme for each agent to customize their ‘dashboard’ which is adverts/view

Now I have Update actions in my Agents controller which I allow the agents to change their profile settings, but when the Agent does a save the default action is to redirect after save() to a view action.

How do I redirect or render to the Adverts Controller instead of the default view of the Agents Controller?

OR simply how do I preferably render (not redirect because I want to set the theme first) from the Agents Controller to the Adverts controller?

thanks guys

Regards

Johan




How do I redirect or render to the Adverts Controller instead of the default view of the Agents Controller?


OR simply how do I preferably render (not redirect because I want to set the theme first) from the Agents Controller to the Adverts controller?



You can pass additional param in the redirect URL to advert controller. and according to that you can set a view for particular agent.

For example pass agent id in redirect url. So,can set a theme in adverts/view page according to that. Since you will get some information for agent.So, before showing something to user you can set a theme first based on the condition. So, that can be easily handle in adverts/view action in Adverts Controller if you get this param related to agent information.

So, set additional param from agent controller which will redirect to advert controller action with additional param passed to advert controller action.Then according to the param you can set theme in Advert Controller action.

Thanks Codesutra for fast reply.

I got the redirect working now.


$this->redirect(array('adverts/index','theme'=>'agent'));

Regards

Johan

cheers ;)