Home

The minimum necessary site structure to run Yii

Published on 12/31/2010


The minimum files and folder structure necessary to run Yii:

/index.php
/protected/components/controller.php
/protected/config/main.php
/protected/controllers/SiteController.php
/protected/runtime/
/protected/views/site/index.php

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()
{
  $this->render('index');
}

That’s it!

If you want use a layout, add:

/protected/views/layouts/main.php
/protected/views/layouts/column1.php

To enable gii, you need to add the /assets folder, and add this to your config:

'modules'=>array(
  'gii'=>array(
    'class'=>'system.gii.GiiModule',
    'password'=>'password',
    ),
),

For Model and Crud to work, you need to setup a db connection.

... views