php - Yii folder structure and global configuration for n applications -


i'm building folder structure , global configuration allow me create applications on yii framework applications share common codes, extensions or modules.

the idea is, each application have business level application, but, can shared between applications, want use common repository (models, extensions, widgets, etc)

for example, want share auth extension control system permission, want 'install' auth under common folder instead under each application.

below, architecture build:

architecture of applications

i found yiiboilerplate similar, don'y configure yii in such way want to.

the folder structure desire is:

common/     css/     images/     protected/         commands/          components/          config/          controllers/          extensions/          models/          views/  application1/     css/     images/     protected/         commands/          components/          config/          controllers/          extensions/          models/          views/  

so, let's go points:

  1. if user under application x (www.applicationx.com) , login page 'common' structure want display user this: www.applicationx.com/index.php?r=user/login.

  2. i want able 'navigate' between application folder , common folder easily.

  3. i not want use theme because have different applications different visual requirements , behaviors.

any thoughts this? advices? in advance!

well, found way of how it.

first of all, folders structure, looks similar it:

common/     css/     images/     js/     extensions/         bootstrap/         auth/     protected/         /* yii default directory folder*/ application1/     css/     images/     js/     protected/         /* yii default directory folder*/ 

config file under common folder

return array(     'import'=>array(         'common.components.*',         'common.models.*',     ),     'modules' => array(         'auth',     ),     'components' => array(         'authmanager' => array(             'behaviors' => array(                 'auth' => array(                     'class' => 'common.modules.auth.components.authbehavior',                     'admins'=>array('admin', 'foo', 'bar'),                  ),             ),         ),         'user' => array(             'class' => 'common.modules.auth.components.authwebuser',         ),         'bootstrap'=>array(             'class'=>'common2.extensions.bootstrap.components.bootstrap',         ),     ), ); 

login

the login under 'common', so, redirect login page, call sitecontroller.php , implented there login process, giving user ability select application wants in.

after login, redirect user application address:

$this->redirect(yii::app()->request->getbaseurl(true) . "/../" .$app. "/" . ""); 

config file under application folder

under application, index.php file has alias common directory, way can still 'talking'.

yii::setpathofalias('common', dirname(__file__) . $directory); 

if want similar , finding hard understand, let me know, put here more information, if need to.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -