I just started with modx, I am getting familiarized to modx world day by day. I have a very wonderful project which I want to implement using modx. Its about creating similar looking websites for a college with same presentation (html,css,js) but different data/content for faculty, departments, courses staff etc for each campus on a single top level domain.
www.collegexyz.com/campus1 // website for campus 1
www.collegexyz.com/campus2 // website for campus 2
www.collegexyz.com/campus3 // website for campus 3
I actually wanted to know what is the best approach in modx to handle this scenario. I learned about contexts but its about replicating presentation, meaning showing multiple faces of a site with similar content. But the scenario described above is the opposite of what contexts are meant to solve, its about same presentation but different content. Surely, we will use contexts when our client demands to customize the user interface for their needs by creating a clone of "web" context and using a different base template but that's a good consideration for future cases and even easy to implement with built-in modx support in form of contexts.
The straight forward solution which comes to my mind in this case is:
1. create a table called sites/subsites with structure such as SiteID, Name, DateCreated
SiteID-----Name---------DateCreated
1-----------Campus1------27 Feb 2014
2-----------Campus2------15 Jun 2015
2. Use the SiteID with each record in other tables like departments, faculty, courses, staff etc.
StaffID----------Name----------------SiteID
1---------------John Dane--------------1
2---------------Marry Parsad-------------1
3---------------Roberts Smith---------------2
3. When ever someone requests the
www.collegexyz.com/campus1/staff
then we will parse the URL, fetch the campus id and pass it to the snippet responsible for querying database and returning the results belonging to that site only using joins. But it can be difficult to manage with a single database as the number of campuses increases from a few to 30 or 40 and can have performance issues and other matters.
Alternatively, We can create different databases for each site with identical schema in that case it will be only a matter of fetching the name of the site from URL (i.e campus1) and pass to snippet to use as database name while while querying the database but that requires creating a separate database for each campus website.
I want to know what is the actual term used in technical community to identify the above scenario so i can search the material, how to best handle the given scenario in general php development and in particular case of modx. It will be pleasure if any one can point me to any articles, tutorials and books both in the php and modx community which discuss and provide multiple solutions to the problem discussed above. You are welcome to ask questions if there is anything ambiguous.