Friday, December 31, 2010

The minimum necessary site structure to run Yii

The minimum files and folder structure necessary to run Yii:
The minimum necessary configuration file is (/protected/config/main.php):
return array('import'=>array('application.components.*'));
SiteController.php should have this method:
public function actionIndex()
That's it!

If you want use a layout, add:
To enable gii, you need to add the /assets folder, and add this to your config:
For Model and Crud to work, you need to setup a db connection.


  1. This article may not the right place to post this question, but as you seem know lot about Yii I would like to get the answer for this question which I have posted in following forum.,

    This is how to pass multiple objects from Controller to View, (actionCreate)

    and other question is how to attach multiple file uploads to a model without declaring field for each entry?

  2. @rasika

    1. to pass multiple objects from controller to view, just add them to the data array in the render function. when you pass 'model'=>$model, you can just add more items to that list.

    2. to allow multiple uploads to a model i would use an array. check the yii wiki for dealing with tabular input.