PHP
How to renderPartial a file in another controller’s view folder for Yii
We can use renderPartial to access a partial file that is stored in a different controller’s view folder.
In Yii 1.1.3, we use the double slash “//” to locate the partial file starting from the views folder. The example below locates a partial stored in
protected/views/library/_book.php
renderPartial(’//library/_book’, array(’books’=>$books))?>
Using single slash “/” will start the searched from the current [...]
YII的路由
有时候我们可能需要自己定义url,以便创建的url能被框架理解或者有时候框架提供的url格式并不是我们想要的,我们可以自己进行自定义。在YII中,提供了CUrlManager来辅助完成。
yii之layout中column和main文件的关系
在yii创建应用成果之后,在view/layouts/目录下,会产生3个布局页面:
main.php
column1.php
column2.php
因为首次使用的是命令行Shell方式创建的应用,yii本身会创建一个控制器组件:Controller.php 继承了CController控制器,该文件位于/components目录下,
01 //componets/Controller.php文件内容如下
02
03 /**
04 * Controller is the customized base controller class.
05 * All controller classes for this application should extend from this base class.
06 */
07 class Controller extends CController
08 {
09 /**
10 * @var string the default layout for the controller view. Defaults to ‘//layouts/column1′,
11 * meaning using a [...]
