Hi guys, (Hopefully I can explain this properly...) I have a client that wants three sub-sites within it's main site that share the same content but each should have a slightly different look 'n' feel, with different logos. (This is a non-CMS site.)
I spoke to a guy some while ago that created some script that, depending on the URL eg (eg. www.mainsite.com.au/subsite1), a specific CSS was applied. This way, whatever URL the user entered, the site would look different. Is this actually possible or am I remembering a conversation that I just WISHED had happened?
You can find the current url via javascript trough window.location.href. After you have this info, you can write out the correct include line.
So within the head of the document you can probably do something like this: <script type="text/javascript"> if(window.location.href.indexOf('google.com') != -1) { document.write('<link rel="stylesheet" type="text/css" href="google.css" />') } else { document.write('<link rel="stylesheet" type="text/css" href="other.css" />') } </script>
If you're going to use that method though make sure you provide an alternative <noscript> stylesheet for any users visiting your site who don't have JavaScript or who have JavaScript disabled.
Ideally something like this should be handled server side though as JavaScript should only be used to enhance behaviour and not used to deliver the presentation.