Welcome Guest, Not a member yet? Register   Sign In
Alternative approach to "multiple applications"... is this an issue?
#1

[eluser]hal10001[/eluser]
I've read up on the multiple applications approach touched on in the documentation, but I'm looking more at multiple sites using the same application code base. However, I just wanted to double-check I wasn't missing something because I'm fairly new to CI. My approach is extremely simple. Basically I create several virtual hosts in my Apache config, and point the DocumentRoot all to the same folder containing the CI framework. Then in my config file I change my base url to look like this:

Code:
$config['base_url'] = "http://" . $_SERVER['HTTP_HOST'];

I'm building a CMS, and the display differences, template selection, pages, users, etc., are all driven off the concept of creating sites instead in the admin. Within the admin you designate your base URL for a site, and the model uses this as a foreign key on other tables to pull various content. The biggest concern I can see in the long run is if you have multiple sites with a whole lot of content that you are running off the same database. I have this working conceptually on my dev environment.

Are there other application design concerns I'm missing? Thanks!
#2

[eluser]xwero[/eluser]
If you want multiple sites running of the same code you just have to identify where the sites are different from each other. One thing i can think of is data. so for each site you have a separate database. Another thing is layout so you need to make your layout flexible for instance by using the same css and image file names but putting them in the public directories of the appropriate site.

All that can be done by making the base_url dynamic so you are on the right track.
#3

[eluser]Jay Logan[/eluser]
I do something like this using sub-domains. Content is pulled from the database based on the sub-domain name. Different layouts can be shown if you store the layout name in the database also. Sub-domains are created from the admin area controller that hacks cPanel's sub-domain feature. I would imagine that it works for domains also. I actually have to create a site next week using multiple domains - same CI install. It's pretty simple.
#4

[eluser]hal10001[/eluser]
[quote author="J-Slim" date="1235510859"]I do something like this using sub-domains. Content is pulled from the database based on the sub-domain name. Different layouts can be shown if you store the layout name in the database also. Sub-domains are created from the admin area controller that hacks cPanel's sub-domain feature. I would imagine that it works for domains also. I actually have to create a site next week using multiple domains - same CI install. It's pretty simple.[/quote]

Because sub-domains and other primary domains are in a separate folder "by default" when you set them up in control panels like cPanel, do you place an index.php in each and change the application directory to the "master" site, or are you hacking the VirtualHost after creating these so that they all point to the same folder?
#5

[eluser]Jay Logan[/eluser]
When my controller creates the sub-domain, cPanel creates a folder named whatever the sub-domain is and my applicatoin puts index.php in the newly created folder. And my base_url is set as "http://".$_SERVER['HTTP_HOST']."/";

And for the system and application folder setting in index.php, I put the full path to it:

/home/username/public_html/system
/home/username/public_html/application




Theme © iAndrew 2016 - Forum software by © MyBB