Welcome Guest, Not a member yet? Register   Sign In
Logic help with multiple sites .
#11

[eluser]Twisted1919[/eluser]
Hmm okay , i'll try that too and see what i can get . I wasn't aware that it can go like this , i don't know why my mind was on that initial mysql_select_db('name') and stick to it .

Once again , thanks for posting here, this thread might help somebody else in feature .

Anyway i'll post again in this thread once i'll do some real progress .
#12

[eluser]Phil Sturgeon[/eluser]
I just put a site_id in all important DB tables, and have a list of domains/sites in the db somewhere.

Quote:id | domain | site_name

1 | foo.com | Foo site
2 | bar.com | Bar site

Then you can have a MY_Controller (or a Public_Controller) which checks if they are using a domain and makes a model call to work out which one.

Code:
$this->site = $this->sites_m->get($this->input->server('http_host'));

Then you can use $this->site->id in all your models to only pull out specific data to that one site. Easy peasy! :-)
#13

[eluser]Twisted1919[/eluser]
Good idea Phil , thanks .
I imagine how will that go for front-end but for back-end i think i am going to need some kind of separation , like /admin/foo_site/posts and admin/bar_site/comments . So here would be useful your MS , or even adding another application folder for the admin area . I am saying this because a site might have some features and other will not have them .
What's your opinion about having all of these into one place in back-end ?
#14

[eluser]Phil Sturgeon[/eluser]
Yeah thats easy enough too. I normally create a controllers/manage sub-folder that handles the various multi-site stuff then both Public_Controller and Admin_Controller contain the detect site code. Manage_Controller will not.

Have a look at this article to see how to set up all those named controllers.

Put your detect_site() function in MY_Controller then you can call it in Public_Controller and Admin_Controller so you are running the same logic. :-)
#15

[eluser]Twisted1919[/eluser]
Easy enough as you say .
I'll give it a try like this when i am at work . Should work just fine .




Theme © iAndrew 2016 - Forum software by © MyBB