Welcome Guest, Not a member yet? Register   Sign In
Multiple Site Setups
#1

[eluser]Mixon851[/eluser]
I have an application written in Coldfusion that I would like to rewrite into PHP using codeigniter. The main thing I am having a problem with is finding a solution to my multiple site problem.

The issue is, for the most part the sites are going to be identical. I dont want to have to edit views and controllers for each site. I would like to be able to use 1 application folder with 1 set of models, viws and controllers since all of the sites will be using the exact same queries and views. With the exception of a custom logo for each site which will be uploaded into the specific folder for the site on the server. They all use the same name.

The way we have it setup now in coldfusion is that when a url is loaded, the server maps to the specific folder for that city where an application.cfc sets an application_id, which is the only thing coded by hand for any specific site.

From there, it sets everything to be displayed from the sincle "application" folder and pulls the appropriate information to be displayed from the database, based on that id. It also sets the id into the session so that things like customers, and records can be accessed using it.

My main question is,..is this possible to do from codeigniter? I have done some research and it seems like using symlinks I can maybe accomplish it, but I haven't found a solution quite like what I need.

Any help or links to some further research would be greatly appreciated.
#2

[eluser]pickupman[/eluser]
A solution would be to move the CI files above your document root, if your hosting allows this. You can then edit the index.php to point up a folder rather than being below it. By default CI guesses to look in the same folder as index.php for a application/system folder. It can be anywhere. You just have to code the path. Some devs prefer this as no files would be accessible via a browser for anyone snooping your folder structure.

Now that you have 1 CI running both sites, I would recommend creating a MY_url_helper.php and add a stylesheet_url() helper function. With extending the helper and creating this function you can create a dynamic link to your stylesheet.
Code:
function stylesheet_url(){
   if($_SERVER['HTTP_HOST'] == 'example1.com')
     return 'example1_style.css';
   else
     return 'example2_style.css';
}

//In my header
<link hr ef=<? stylesheet_url();?> type="text/css" rel="stylesheet" />

This website is run on CI, and the commercial product ExpressionEngine is multisite running on CI.
#3

[eluser]Mixon851[/eluser]
Cool, thanks for the advice. I will give that a shot. As for the stylesheet, that gets dictated by the id also. We have a backend that lets them choose from preset colors, so its just a database call for that.

We have one css folder with the stylesheets in there, and then depending on what value the db call returns we output the correct file name.

Thanks again.
#4

[eluser]pickupman[/eluser]
Good luck.
#5

[eluser]umefarooq[/eluser]
for more information read this articel will help you to solve your problem

http://philsturgeon.co.uk/news/2009/06/H...ter-Set-up




Theme © iAndrew 2016 - Forum software by © MyBB