How to set up a "mother site" application so the code is only in one place?

Hey,

I am developing an application for restaurants to build their own website (similar to www.letseat.at). The websites will be pretty cookie cutter, and all restaurant-specific data will be stored in one database. Each restaurant will have its own domain and be hosted on my server. My question is this:

What is the best way to set everything up (domains, file system, templating) so that the main application code is only in one place on the main server? The only differentiation between restaurants will be layout and data.

Hopefully you understand what I am asking - I am really struggling with this.

Thanks,
Miles

Youve got 2 main views to consider.

Admin pages - where restaurants login and control their data. Give them all a single place to login, be very paranoid about permissions, make sure each database user has permission to change his own tables only for example.

Public pages - their own domain, yeah, sure. Take a look at setting up Apache to use the Alias commands in your virtual hosts.

Inevitably though, some restaurants will want “that little bit more”, and will be willing to pay you to create something for them, so you have to balance ease of use for yourself with the possibility to override settings, override templates and ultimately to insert whole new pages.

If the only difference is layout and data then you could park all domains on one main domain. You could then check the host and grab the configuration from the database based on that host. I have done this with landing page scripts and it works great. When I have had to use different IP addresses though I tied my program into a control panel’s API (cPanel works great) and added them that way. I would not recommend simply creating multiple accounts and placing configuration files in there because it will use more space and be a headache to organize. Also if you want to point all the restaurant sites to one main control panel using the host method works or if you do want to create multiple accounts just create a shared folder across all of the accounts /usr/bin/share and add it to your Apache conf file. Hope this helps; know you must have a dedicated environment (VPS, Dedicated Server).

Yes, exactly.

Not sure I understand…could you elaborate please? Or provide an example?

Use common functions/forms/pages, and include a directory-specific config.php file that tells the server which restaurant is calling the function/page/form.

Darren,

That sounds more along the lines of what I was thinking. So you are suggesting that if I have WWW.MAINDOMAIN.COM and WWW.SUBDOMAIN.COM, then I have SUBDOMAIN point to MAINDOMAIN? That sounds like a simple idea, but I do not know how to implement. How do I go about doing this?

Miles

EDIT:

I think this is the simplest way. Correct me if I’m missing something?

  1. Put all files into one folder at top level of web root
  2. When adding an “addon domain” in cPanel, it asks you which folder you want that domain to point to. Choose the folder from #1 for all sites.
  3. The code determines the restaurant by checking the hostname.