2 sites with smae database / models


I’ve been using to Yii to make an internal console on this kind of url console.myapp.com/index.php . It’s pretty dirty and now we want to provide a console for our customers. I have to make a new site with the same database. I wander how to do this.

Should I make console.myapp.com/customers/index.php url , and in this case do I just have to create a new index.php in the directory customers ? Is it the right way to do this ?

Or maybe I should create a new url customersconsole.myapp.com/index.php ? and in this case how can I share the same models instead of duplicating them ?

Thanks a lot, I’m a bit lost.

I would not write a new application for the same database scheme with the same models. That’s like starting from scratch which is most of the time not a good idea.

Fix the dirty code, clean it. Copying dirty code is useless. Then add the controllers, views and models for the customer console. You can separate the traffic from your customers using the router.

Thx. This link on url management helped a lot. So I’ll change the way the urls are handled to show directories instead of url arguments. A lot cleaner.

I can create new controllers and views for the customers console.

Now I need to undertand how I can customize the headers, and the look@feel of the customer console while keeping the old console the same. I will search the site for that, but if you have some tips, thx.