Jump to content

How would i...


Dane

Recommended Posts

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

Link to comment
Share on other sites

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."

Link to comment
Share on other sites

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."

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.