site/index.php 里的变量可以在siteController.php里的actionIndex里赋值


因为我做后台 是 上左右结构 我把左边的挖出来了 其他的都没变


你可以在protected>config>main.php 中设置你的变量。


参考yii自带的blog demo代码,顺摘抄如下:

(1)protected>config>main.php 中添加如下代码:

	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']


(2)protected>config> 目录下,添加params.php文件,并填写类似代码:


// this contains the application parameters that can be maintained via GUI

return array(

	// this is displayed in the header section

	'title'=>'My Yii Blog',

	// this is used in error pages


	// number of posts displayed per page


	// maximum number of comments that can be displayed in recent comments portlet


	// maximum number of tags that can be displayed in tag cloud portlet


	// whether post comments need to be approved before published


	// the copyright information displayed in the footer section

	'copyrightInfo'=>'Copyright &copy; 2009 by My Company.',