Right aproach for the project?

Hi there,

My company is starting to use Yii to develop medium and big applications. We have a custom framework.

Ive already read the difenitive guide, Ive done the blog tutorial, and Ive checked some wikis but since Im kind new here I havent found the right aproach for our deveploment.

We ll starting rewriting our costum cms to Yii.

I was thinking about an admin module for backend with sub modules for each item, like news, products, banners, etc… But i need to use this sub modules models in the frontend.

Can i do it in a easy way? Am I complicating this too much? Is there a better aproach to this?

What we are thinking is separate the backend from frontend, but in the frontend is better to reuse the same models to save time.

Can some give us some advices?

Thank you.

I have a similar approach, my setup is not perfect but not bad either, ie. it could benefit from some tweaks.

  • Admin application and main application each have their own config file.

  • Models are shared between front end and back end

  • Components are in backend

  • Assets folder is common to front end and back end

config for admin (excerpt) entry script is located in mainUrl/admin




// uncomment the following to define a path alias

$path=dirname(dirname(__FILE__));

list($mainpath, $scrap)= explode('admin', $path);

Yii::setPathOfAlias('applicationDir',$mainpath.'protected');


            'assetManager'=>array(

            // change the path on disk

                'basePath'=>$mainpath.'assets/',

                'baseUrl'=>'/assets/'

        ),



this stuff is in the front end config




$path=dirname(dirname(__FILE__));

list($mainpath, $scrap)= explode('protected', $path);

Yii::setPathOfAlias('adminDir',$mainpath.'admin');


// autoloading model and component classes

	'import'=>array(

		'adminDir.models.*',

		'adminDir.components.*',

	),




Like I said the system could be improved but this gets you close to being able to re-use models and components.

I have run into problems with shared models (various reasons) so generally I have created a separate model in the front end ‘models’ directory when required.

doodle