i want to make a blogging system like blog.com.
so i need to generate a subdomain each time a user register in my site. and have they own template.
so i need to make a template with deferent content for each user. how should i achieve this?
i thinks it is something about $_SERVER variable.
any help would be appreciated.
You can make virtual subdomains and configure your server to treat each subdomain as parameter for the single script.
john.site.com would map to
site.com/index.php?user=bob. Then your script may analyze
user parameter and grab different data from database.
There are lot of tutorials on this topic around, like this one
In fact there is no point in configuring a server to treat each subdomain as a parameter, simply because the requested host is always available to PHP.
A custom template could be a problem though. There needs to be a storage for them.
May be a directory with subdirectories for each user. For this, a simple rewrite rule could be of some use.
Well, requested host is a parameter itself
If these templates differ only with CSS (most obvious solution for the blog platform IMHO), then it’s quite easy to store custom styles in database. Even simplier if there is predefined set of templates that users can choose from. In this case
template_id is the only thing to store.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.