![]() |
Suggestions wanted for best practice - SaaS CMS - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Suggestions wanted for best practice - SaaS CMS (/showthread.php?tid=38964) |
Suggestions wanted for best practice - SaaS CMS - El Forum - 02-24-2011 [eluser]otherjohn[/eluser] Hi all, I am building a SaaS cms and have decided on using CI for the project. Basically, we are building a multisite cms (SaaS) and will have: Multiple domains each with their own site all running on one app and one DB So, i figured I would pair up all data with a "Site ID" which is grabbed as app launches. The question is what point should I grab this and how should I pass it on for all other use (routes, db calls,etc). Should I hook it into the first hook and store it in a global var, or should I do something else like grab it on each route and possibly put the "getSiteID" in the route file (it would need a DB call). Or are these silly ways to do something much easier to do? Looking for best performance practice on this one. Any ideas? Thanks John Suggestions wanted for best practice - SaaS CMS - El Forum - 02-25-2011 [eluser]cmgmyr[/eluser] I have done this same thing. I have a "domains" table and within all of the other tables I have a "domain_id" index. When loading the application I have a "startup" library that runs a number of functions, the main one being find the current URL, matching it up to the DB, and getting that domain_id. The domain_id is saved to a session so that I can easily get to it later. Throughout the whole application I use the domain_id to pull the template location for their website files and their information from the database. You definitely don't want to put that domain_id in the URL's. I hope that helps and if you have any other questions, please let me know. -Chris Suggestions wanted for best practice - SaaS CMS - El Forum - 02-25-2011 [eluser]Vheissu[/eluser] The open source CMS Halogy supports multi sites on the one installation: http://www.halogy.com/ - it's built on Codeigniter too. You might find the code useful for ideas on how they handled multi sites. |