CodeIgniter Forums
Multi-domain architecture - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Multi-domain architecture (/thread-4753.html)



Multi-domain architecture - El Forum - 12-13-2007

[eluser]ccachor[/eluser]
I'm working on a project that is similar to a CMS where I'll have multiple templates all using the same codebase. Each 'client' will be able to load their own information for Name, Address, etc. so I need this information to switch out based on the domain. I'll have a domain field in the database to match against my variable.

I was thinking I would set a domain variable as $_SERVER["HTTP_HOST"] then use some SQL to pull everything based on that. However, I'm just not sure where to put that variable. Use it as a global?

Has anyone done anything similar?


Multi-domain architecture - El Forum - 12-13-2007

[eluser]Michael Wales[/eluser]
I would just extend the loader class, particularly the view() method. Have that method check $_SERVER['HTTP_HOST'] and query the database for the particular template that domain is using. Then load the appropriate files based on that information.