Welcome Guest, Not a member yet? Register   Sign In
One CI install, One admin section, multiple sites?
#1

[eluser]Devon Lambert[/eluser]
Apologies if this has been posted previously, I did do some searching but came up with nothing relating to this particular issue. I have a slightly different scenario than the typical "one CI install, multiple sites" to propose to you all.

I plan on a creating a series of sites that operate in the same realm/business model. I intend on building out a CMS specifically for this purpose. I will be the primary (read: Only) admin for all of these sites. Therefore I would like to create 1 simple admin section that can be used to manage all of them.

How would I go about doing this? (From a Database/code design perspective)

Are there any tutorials that you can point me towards?

Thank you.
#2

[eluser]dchuk[/eluser]
I'm building the exact same thing. It's actually not too hard. I have set up my base_url to be whatever the domain is that is calling the app (the code is floating around here, it's what people use to upload their site to their servers without having to change any config info). Then, I have a set of controllers for the admin part and a set for the public side. In routing, I have a conditional check run, and if the domain calling the app is my admin domain, it routes to the protected admin area. Otherwise, it routes to the public controllers. Once there, the public controllers do a lookup to find out if the app has a site for that domain, and then responds with the data for that domain.

By having a domains table, you can then assign a domain_id to every single item in your database, making it really easy to only load up data for your specific domain.

Other than that, you just need to park your domains on your server. I have found code to use the NameCheap api to purchase the domains and a CPanel api to park the domains, so you can actually do everything from right inside your app if you want.
#3

[eluser]Udi[/eluser]
Sites for this manner are like "categories", each item you create [content page, gallery photo] you relate it to the site.
1 Database
1 Application [if you really want, you can create 2 applications, one for admin and one for all the sites - but I don't recommend that]
#4

[eluser]Devon Lambert[/eluser]
So it sounds like one database is the way to go?

I was hoping to avoid that some how but I suppose with this scenario it is unavoidable.

Thanks for the advice. :-)
#5

[eluser]Udi[/eluser]
I don't see any reason for you to avoid this idea...

The only "serious" thing you have is the template system to support without a problem different view sets [set = 1 site]..
#6

[eluser]dchuk[/eluser]
[quote author="dnyce" date="1262748535"]So it sounds like one database is the way to go?

I was hoping to avoid that some how but I suppose with this scenario it is unavoidable.

Thanks for the advice. :-)[/quote]

The only reason I see for possibly going with separate databases is if you need to keep the data very separated for maybe some sensitive type of stuff. But even then, I think it's more hassle than necessary. By keeping yourself with one DB and one app, you keep your headaches down to a minimum.

I personally think that anyone who builds 3 or more sites that have the same function or purpose but just have different data should build a one app/multiple site system. Makes development and upgrades soooo much easier.

Great for micro niche sites as well ;-)




Theme © iAndrew 2016 - Forum software by © MyBB