* system: refers to the Yii framework directory;
* zii: refers to the Zii library directory;
* application: refers to the application's base directory; (/protected/)
* webroot: refers to the directory containing the entry script file(index.php).
* ext: refers to the directory containing all third-party extensions.
Importing Classes
Yii::import('system.web.CController');
Using Class Map
To pre-import a set of classes, the following code must be executed before CWebApplication::run() is invoked:
// define namespace:
namespace mynamespace\controllers;
// since class is now under namespace, global namespace
// should be referenced explicitly using "\":
class TestController extends \CController
{
public function actionIndex()
{
echo 'This is TestController from \mynamespace\controllers';
}
}
Root Alias
Importing Classes
Using Class Map
To pre-import a set of classes, the following code must be executed before CWebApplication::run() is invoked:
Importing Directories
Namespace
protected/config/main.php
controller code should be properly namespaced: