My question is based in structure and architecture really and I'm after ideas on the best way to implement the following:
I am using code igniter (although you could presume any MVC framework). I have a custom CMS which allows for the management of 5 different websites. Users log in and switch between these sites. They can add content to each of the areas of the sites. The CMS and data that can be entered is the same for each site.
The public facing sites all look completely different and represent different brands even though they contain the same data as all the others.
So how would you go about implementing these views? Are there any design patterns I should be looking at ?
The only way I can think of doing this right now is to put a switch statement inside of each controller > action to grab a different view for each website but I'm thinking there must be a much more clever way of doing this. How can I get around not producing loads of code that looks like this ?
I need a better way than this in each action...
<?php
class Home extends Controller {
public function getPage()
{
$website = $this->session->userdata( "site_id" );
switch( $website )
{
case "1":
// load view one
break;
case "2":
// load view 2
break;
// etc etc
}
}
}
edit: corrected $website variable