Hi all,
I'm about to begin a project that will span across multiple domains and have come up with some potential pitfalls - maybe some of you have come across the same problems before...
By the way, I'm using Zend Framework as the core framework
OK, say we have domain123.com and domainABC.com (but there could be many more).
The codebase should remain very much the same across all domains as far as core functionality is concerned, but there will be some differences across the domains.
For example:
* Forms defined in ZF may have slightly different fields over different domains
* Templates used with MVC will differ over domains
* Models may differ for some domains
* Access to controllers/actions could be different over domains
I predict that the majority of these will remain over domains, however I need to create a transparent way of switching between forms, models and access lists based on the domain. This in itself doesn't pose too much of a challenge - I'm just concerned that doing it will introduce duplication into my code. Anyway, my thinking is as follows:
- DomainController.php (handles setting of application-wide settings such as baseURL, domain name etc that will be used by the rest of the application when deciding which forms/models to load)
- UserModel.php (example of the base functionality of a user model)
- UserModel_Domain123.php (extended from UserModel.php - provides custom functionality for Domain123.com)
- Globals.php (Some utility methods would be available that would first check for a domain specific file (such as UserModel_Domain123.php) and if that wasn't present, then load UserModel.php as default)
This same technique will apply to the Forms problem.
The problem with this technique is that I need to do a file_exists() call every time a form class or model class is loaded - something i'm not particularly keen on doing to be honest.
Does anybody else have any experience with this sort of architecture - or any thoughts on problems like this - or can anyone point me in the direction of articles/discussions on this topic?
Thanks in advance
Multi - Domain Project
Moderator: General Moderators
- freeformer
- Forum Newbie
- Posts: 14
- Joined: Tue May 13, 2008 1:54 pm
- Location: UK