yii 框架中的主题和布局
我是 Yii 框架的新手,正在创建基于模块的 CRM.使用不同的教程,我可以创建自己的主题,但现在我陷入了困境.
I am a newbie in Yii Framework and creating a CRM which is module based. Using different tutorials I am able to create my own theme, but now I am stucked at one point.
在我的主题中,上部 和左侧
在整个应用程序中保持相同,直到用户登录.这就是为什么我把它作为我的 main.php 的一部分,但在登录页面没有按钮显示,只是简单的登录表单,带有 2 文本字段.
In my theme, the upper <nav>
and left <nav>
remains the same throughout the app, until user is logged in. That's why I made it a part of my main.php, but in the login page there are no buttons to show, just simple login form with 2 textfields.
如何使用自定义主题在我的应用程序中实现此表单?
How can I implement this form in my application using custom themes?
我曾尝试在该特定操作中定义布局,但未成功.任何帮助将不胜感激.
I have tried to define a layout in that particular action but not succeeded. Any help would be appreciated.
推荐答案
为您的视图使用自定义布局是正确的方法.您可以在控制器操作或视图中设置布局.
Using a custom layout for your view is the right way to go. You can either set the layout in the controller action or in the view.
$this->layout = "//layouts/mylayout";
请注意,默认布局 column1.php 和 column2.php 也使用 main.php 布局文件.
Note that the default layouts column1.php and column2.php also use the main.php layout file.
相关文章