RavenStar Posted March 9, 2008 Share Posted March 9, 2008 I have several domains all parked on top of the main one, and I want the template of the site to be determined on which domain they go to. So if they goto www.site1.com it shows template A and if they goto site2.com it shows template B and so on. Here is what I have so far, which isn't working; $url = $_SERVER['HTTP_HOST']; if (strpos($url,"siteA.")) { $template = 1; $title = "Welcome to SiteA"; } else if (strpos($url,"siteB.")) { $template = 2; $title = "Welcome to SiteB~~"; } ..and so on, it goes for awhile. I know I should probably have the $template and $title in an array, but I don't know how to go about doing that. How can I achieve what I am trying to do? Thanks~ Quote Link to comment https://forums.phpfreaks.com/topic/95204-template-based-on-domain-name/ Share on other sites More sharing options...
rcorlew Posted March 9, 2008 Share Posted March 9, 2008 Set up a database with template name and all that in there, then when someone goes to site1.com, store that as a $_SESSION variable. You could also set up a directory tree and pass all the css and stuff off the DB before creating the HTML, thus the ability to host multiple sites on one server/account. Quote Link to comment https://forums.phpfreaks.com/topic/95204-template-based-on-domain-name/#findComment-487676 Share on other sites More sharing options...
RavenStar Posted March 10, 2008 Author Share Posted March 10, 2008 Thanks for the reply. I have thought about storing it in a database but decided against it for a few reasons. The reason I'm trying to do it the way I am, is so I can just have one copy of the core files under one account instead of having an account for each domain. In my example above, I am not sure if I'm using strpos correctly as it isn't working. Could some assist me in working out my above code to make it function? Thanks~ Quote Link to comment https://forums.phpfreaks.com/topic/95204-template-based-on-domain-name/#findComment-488242 Share on other sites More sharing options...
Nuv Posted March 10, 2008 Share Posted March 10, 2008 I know this might be the same but,try this if (strpos($url,"siteA.") === TRUE) if (strpos($url,"siteB") === TRUE) Quote Link to comment https://forums.phpfreaks.com/topic/95204-template-based-on-domain-name/#findComment-488262 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.