in the old discussion page ,you see some one advice we should develop the backend as a standard app .but when you access front-end from backend the url is a problem ,because they are use different entry script(index.php and the admin.php(whatever the name is )) see the post How to create URLs to other applications.
in both situations we all want share some basic classes( such as models ,helper functions and so no…),most of times we only need the “admin” views for backend manager missions (may be you also need create / update),these can be generated by gii .you can copy if from another modules or use gii again to generate a duplicate views(admin create update, when generate the “crud” you can use pathAlias to reffer to other modules 's components like : album.models.someAr),but the models you should share with other modules (single control point is necessary ,bussiness logic shouldn’t scatter everywhere ) ,for accessing
the components from other modules , use Yii::import or config imports in main.php or import it in you admin module (see the rights extension and the gii):
// Set required classes for import.
$this->setImport(array(
'rights.components.*',
'rights.components.behaviors.*',
'rights.components.dataproviders.*',
'rights.controllers.*',
'rights.models.*',
//another models from different modules
'common.auth.models.*',
'common.auth.*',
));
//
$this->controllerMap = array(
'kauth'=>array(
'class'=>'common.auth.forRights.KAuthController',
),
);
// Set the required components.
$this->setComponents(array(
'authorizer'=>array(
'class'=>'RAuthorizer',
'superuserName'=>$this->superuserName,
),
'generator'=>array(
//'class'=>'RGenerator',
'class' => 'common.components.KMcaGenerator'
),
));
you see we can use "import" to share the models from another modules(helper ,util classes are the same), we can replace the global components use module::setComponents method ,normally you may use a different "XWebUser" from the front-end one .
in another view , if you choose standalone app as your backend ,what you should do
, we all don’t want repeat ourselves .