开发者

How can I switch between views from one action in a controller

开发者 https://www.devze.com 2023-03-26 16:55 出处:网络
I\'m building a job site where you have two types of users who sign in i.e job seekers and prospective employers. Now both create their accounts from different sign up pages however 开发者_开发知识库t

I'm building a job site where you have two types of users who sign in i.e job seekers and prospective employers. Now both create their accounts from different sign up pages however 开发者_开发知识库they sign in from the same login form and are redirected to their account pages. The thing is that the base account page for each should be different5 obviously however I need it to point under the exact same url i.e www.mysite.com/my-account

What would be the best way to do it, is it possible to choose from within a controllers action what view to use here?


You can render a different view inside the controller with $this->render('path/to/view.phtml');

A cool way could be in the init of your controller you set a different base path for the view according to the type of account $this->view->setBasePath('/path/to/account/type/'); So you don't need to call $this->render(); but the render directly will look into the right folder, if you have one folder per account type

0

精彩评论

暂无评论...
验证码 换一张
取 消