i'm a new Yiier, i have a question that how could creat 2 colume layout with yii 1.1, i means the width 190px of left div is for menu, the right is for body,the width of right is 100%,and i need a div as footer under the body div,height is 50px. Thank you very much for your Help.
1 Answers
If you are using default Yii layout and style.
You should enable column2 layout in the controller of the views where you need 2 column. Or if you need it project wise do it in protected/components/Controller.php as every Controller extends this one.
So the property declartion is:
public $layout = "column2";
This file can be found under protected/views/layouts/column2.php
In this file you will find two divs with classes span-5 and span-19. If you open screen.css you will see widths of those classes 190px and 750px respectively. In the div with class-5 you can find widget CMenu in a Portlet which you should use for your menu, it is getting item list from property $menu which is simple associative array.
Similar property declaration as before:
public $menu = array(array("label"=>"Hello", "url"=>"world.com"));
Now that you have set up this, you will find your menu on the right side, you can easily rearange this. Put the div with class span-5 under the div with class span-19 and move class last from span-5 to span-19
The div footer doesn't have property height defined which means it expands but you can easily add your own style with property height set to 50px and maybe add overflow: hidden which will hide everything that goes beyond 50px. You add these properties in your own file under ../protected/css/ directory and call it with
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl."/css/yourFileName.css","screen, projection");

- 194
- 5