SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow 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


  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure I understand...could you elaborate please? Or provide an example?


  4. #4
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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).
    Have a good day.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


  6. #6
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, exactly.
    Have a good day.

  7. #7
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •