Jump to content
xisto Community
Sign in to follow this  
infamousflame

Applying Css Through Links. Different CSS through different links?

Recommended Posts

I work on a website, and on this there are three different colour schemes. These are currently selected by clicking on the desired colour in a flash shockwave object on a page.This requires that there are three large directories on the server, blue, pink and orange. Each one contains a coloured copy of the website. The things in each directory are: HTML pages, a css giving it it's colour and flash buttons that were coloured the three different colours when they were made.As you can imagine, this is a nightmare to update, as it requires that each page is copied to three different directories. :P I would be very keen to have things set up so that when the pages are updated, every colour updates at the same time. I understand that I would need to still have three different sets of buttons and these would still need to be in their right places on the server. However, these are already created and so should not need to be changed.I was wondering if applying one of three different CSSs to the site depending on which colour scheme the user wanted to see. I thought this may be accomplished using links to apply the CSS but I don't know if that's possible.Thanks in advance for any replies, :PInfamous.

Share this post


Link to post
Share on other sites

Here you go. This one is done in java script: Spoono's Stylesheet Switcher

It is extremely easy to do it in PHP, i have made one myself for use a long time ago. If you would like it i will give it to you, just send me a message or reply here.

Share this post


Link to post
Share on other sites

If you already have the CSS files why don't you import them? or link to the CSS file, it is one of the great things about css, insteat of rewriting you just reference the particular file or with PHP make a switch case that uses the CSS you want. It is really simple. Send a PM to find out more.

Share this post


Link to post
Share on other sites

Thanks a lot for the info guys :P , my friend who also works on the site says he knows how to do it now. I think it's because he's been learning javascript through a WebMonkey course. Anyways, if he can't manage it, I'll come back and ask for some more help.

Share this post


Link to post
Share on other sites

I know the site your on about, not a god damn chance, we will not be using Javscript for something so easy. There is no hard work involved.How it works, let me explainSite index.php - choose a colourorange/blue/pink - goes to directory then in directory is folder named images and a css file, for colouring itNow, for each folder, the images folder has the images for that colour, and a CSS file to colour the page, so when you switch colour at the very first page, you goto the same site, but in a different colour.Either that, or we do start using a proper templating system LIKE I suggested so many months ago. We arent coding silly bits of javascript, thats just gonna cause trouble.Stop wasting time, you seem to have been speaking to Adam, he loves the idea of over doing things, lets not remember he is the boy, who argued, flash should replace all web code.

Share this post


Link to post
Share on other sites

Stop wasting time, you seem to have been speaking to Adam, he loves the idea of over doing things, lets not remember he is the boy, who argued, flash should replace all web code.

<{POST_SNAPBACK}>


I'm not wasting time and haven't been speaking to Adam, well, I have but not before I started posting this and this was not his question.

 

That defeats the whole point of my question the way you suggested though. The point is I am trying to reduce our workload, and connec came up with an idea that he can do it just through CSS and HTML, which i know are the same things, but you know what I mean.

Share this post


Link to post
Share on other sites

But it isnt a workload, the code is exactly the same. Its like looking for a way to find a needle easier in a hay stack, theres only one, working way, that doesnt involve more work than is really needed.

Share this post


Link to post
Share on other sites

So you have three different CSS files, three different sets of images and content that is meant to be displayed with all these different styles.Unless you absolutely need to change the style on the fly, ie. on client-side, don't use javascript! I'd suggest doing a template system. It is really lot easier than you might think. You just need a way to save the preference of the user (if you let the visitors to select the style), that could be either cookie or a session. Then HTML templates, with the content (and possibly menus and such) replaced with keywords. You should be able to use your current files, with just removing the content and replacing it with something like [CONTENT]. Then have PHP change the keyword into the content, that you have stored only once, with function like strtr() (string translate). You could naturally also use CGI or ASP or whatever you feel most comfortable with.I'd say that's just as easy if not easier to do than the kind of javascript stuff. The difference is that this will work on everyone's browser without requiring any specific browser settings.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.