Organization Application Directory

Hi Dear,

I want to organize my application as

-App Root

-- common // For all sort of common elements of the application




---------controllers etc


---------controllers etc










How can I do configure it?


Just Play with your main.php

and have the structure as you want.

Yii - Yes It Is Indeed

I am happy that you solved, but why not to use modules?

This will create a structure like:


-- models















This structure will hold in the same directory all files related to a certain model, is supported by gii and also allows you to add rules on the whole module (for example forbid the backend module to non-admin user and so on).

PeRoChAk and zaccaria, Could you show me your config that allowes this directory settings ?

@ zaccaria

Thanks for your insight.

Actually, what I am going to develop have the features as

1 - User can select their own templates(Layouts)

2- User can select their own skins (themes)

3- System will be plugin based so that new functionality could be added with eases.

Current structure of Yii Application does not allow me to have

1 - Custom skins

3 - Custom Templates

So, I do need to have my own structure


I will share it

Here is my Configuration file


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(


	'name'=>'My Web Application',

	// preloading 'log' component


	// autoloading model and component classes







		// uncomment the following to enable the Gii tool




			'password'=>'My Gii Pass',







	// application components



			// enable cookie-based authentication



		// uncomment the following to enable URLs in path-format












			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',


		// uncomment the following to use a MySQL database



			'connectionString' => 'mysql:host=localhost;dbname=whp',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '',

			'charset' => 'utf8',







			// use 'site/error' action to display errors








					'levels'=>'error, warning',


				// uncomment the following to show log messages on web pages









	// application-level parameters that can be accessed

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


		// this is used in contact page




Thx alot for you kindness =))) I got couple of questons :


[*]why are you not using urlManager?

[*]Is it ok for you to have 2 db components?


  • why are you not using urlManager?

    I will use it based on requirements.

    • Is it ok for you to have 2 db components?

    No problem. We can have as many DB connections as we need.