Single codebase, multiple sites Does Yii support this? And if not, what is the best way to go about it
Posted 14 June 2010 - 03:53 AM
When I say domains configured differently, I mean that these can be completely different websites, not just different themes per website. So one site can be a job listing site, another can be an article submission site, etc, all using the same "core" that handles users, auth, common components etc etc.
I have started looking into this a bit, and it's obvious that the default way Yii works isn't suited for this. For one thing, I would need a "websites" table in database, which stores site-specific config. But in order to read this I need the db object configured, which is also site-specific (different sites can sit on different databases).
I thought about using the themes folder but calling it "sites" instead, and using it like a theme which also includes the site-specific config, etc. Then in sites I would have "sites/example.com", "sites/example2.com" etc, and in index.php I would need to read the site-specific config according to which domain has been accessed.
Another thing is that each site would have different controllers, actions, layouts etc, and therefore I thought of creating a SiteModule which is a type of module that pertains to a certain website "type". So I could have a jobs module for the job websites, an article module for the article websites, etc.
I am only starting to solve this problem, but I would be happy if anyone has any experience they may share, or even better, code that does something similar.
Thanks in advance!
Posted 14 June 2010 - 10:19 AM
Posted 16 June 2010 - 01:10 AM