Dane Posted November 17, 2007 Share Posted November 17, 2007 http://www.xippy.org is a website that uses one peice of code to create many team websites. all by the subdomain. Basically im wanting to use the formular they use..... For example. /www 1.php 2.php 3.php 4.php 5.php 6.php # tables in the database would be `teamname_news` `teamname_members` `teamname1_news` `teamname1_members` `teamname2_news` `teamname2_members` Going to teamname.mydomain.com would use the code in the /www dir and extract `teamname_news` `teamname_members` because of the subdomain being teamname. If the subdomain was teamname1.mydomain.com it would extract `teamname1_news` `teamname1_members` because of the subdomain being teamname1. But it is still using the same peice of code from /www How would i go about doing this and what is the best way of doing it? Ive been trying to do it, and thinking about it for nearlly 14 hours today and im getting no where. Thanks Quote Link to comment Share on other sites More sharing options...
linuxdream Posted November 17, 2007 Share Posted November 17, 2007 Looks like they are simply using a standard template for the layout and custom style sheets for each "team." Something like: <?php $host = parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST); require_once('/cssdepot/' . $host . '.css'); ?> placed at the beginning of the template would work to include each custom css file based on the host. You would just have each custom css file stored in /cssdepot/ named after each "team." Quote Link to comment Share on other sites More sharing options...
Dane Posted November 18, 2007 Author Share Posted November 18, 2007 How would they go about the database. The code and the subdomains getting each teams name. Quote Link to comment Share on other sites More sharing options...
linuxdream Posted November 20, 2007 Share Posted November 20, 2007 Well, as long as you have some sort of header file that is included at the of each page (using the idea of one template for many looks, this is a given) then you can just parseurl() out the host portion and set it in each script. Or pass it around as a cookie or session data. This is how we use a single template for 30+ clients at my work. We actually have a function that is called automatically at the beginning of every page that automatically gets the host portion and keys everything off that. For the database side, I suppose you can have a separate DB for every "team" but you could also just as easily combine them into one big table (like data...meaning account info in one table, settings in another, etc.) and index the proper fields. Performance is good and you only have to manage a few tables in one DB instead of duplicate DB's or tables for each "team." Key them off the unique host and use that host for managing everything for that specific "team." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.