Theming and layout in yii framework(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.
这篇关于yii 框架中的主题和布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:yii 框架中的主题和布局


- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- PHP - if 语句中的倒序 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01