bookmark - Applying Css Through Links. Different CSS through different links?

Applying Css Through Links. - Different CSS through different links?

 
 Discussion by infamousflame with 10 Replies.
 Last Update: July 17, 2005, 5:52 am
 
bookmark - Applying Css Through Links. Different CSS through different links?  
    
free web hosting
 
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, :P

Infamous.

Sat Jul 9, 2005    Reply    New Discussion   


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.

Sat Jul 9, 2005    Reply    New Discussion   

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.

Sat Jul 9, 2005    Reply    New Discussion   

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.

Sat Jul 9, 2005    Reply    New Discussion   


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 explain


Site
index.php - choose a colour
orange/blue/pink - goes to directory
then in directory is folder named images and a css file, for colouring it

Now, 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.

Sun Jul 10, 2005    Reply    New Discussion   

QUOTE (Trekkie101)

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="43694"]<{POST_SNAPBACK}>[/post]


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.

Sun Jul 10, 2005    Reply    New Discussion   

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.

Sun Jul 10, 2005    Reply    New Discussion   

Well, currently, we have to copy all the content over three dirs, this just is not necessary, so we should try and stop it.

Sun Jul 10, 2005    Reply    New Discussion   

Copying 1 file takes less than a second, uploading takes less than one second. I just dont see how it adds anything extra to any workload.

Sun Jul 10, 2005    Reply    New Discussion   

Trust me, it does, especially through net2ftp. grr, websense.

Sun Jul 10, 2005    Reply    New Discussion   

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.

Sun Jul 17, 2005    Reply    New Discussion   

Quickly Post to Applying Css Through Links. Different CSS through different links? w/o signup Share Info about Applying Css Through Links. Different CSS through different links? using Facebook, Twitter etc. email your friend about Applying Css Through Links. Different CSS through different links? Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

My New Template I Made   My New Template I Made (26) (7) Creating Expanding Menu Tree In A Web Page sharing my knowledge  Creating Expanding Menu Tree In A Web Page sharing my knowledge