简体   繁体   English

从YII中相同控制器或不同控制器的不同动作移动时,如何在不同主题之间切换

[英]How can I switch between the different theme while moving from different actions of same controller or different controller in YII

I have just started YII one week back. 一个星期前,我刚刚开始YII。 I have made a theme in that is 我做了一个主题是

\themes\yog

it is very small project, just 4-5 forms, those are mostly fro the admin. 这是一个非常小的项目,只有4-5个表单,这些表单大多数来自管理员。 so what i want now it suppose i am using the 所以我现在想要的是假设我正在使用

site/login

route, I want to render it via YII's default views . 路线,我想通过YII的默认视图渲染它。 ie

\protected\views

I want to run the default views for only some actions, like login, or adding news, event and other admin related tasks. 我只想为某些操作(例如登录或添加新闻,事件和其他与管理相关的任务)运行默认视图。 But other actions should render the views from my new theme. 但是其他动作也应该呈现我的新主题的观点。

Thanks. 谢谢。

In that SiteController set Yii::app()->theme to a non existing theme, and it should fall back to use the views from the protected/layouts file. 在该SiteController中,将Yii :: app()-> theme设置为不存在的主题,并且应该回退以使用protected / layouts文件中的视图。

If you want to specify different layout files read this: Yii: Render action using different layout than controller's layout 如果要指定不同的布局文件,请阅读以下内容: Yii:使用与控制器的布局不同的布局渲染动作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM