Is there an alternative file extension, that can be used as a stylesheet?
I am thinking of something dynamic and wondered if stylesheets have to have a .css extension at all. If not then is there a list of alternatives.
02-03-2005, 04:32 PM
Any file can have any extension - it's all about the headers.
For example - a dynamic stylesheet could have the extension .php, and still work as a stylesheet, providing you send the right header at the top:
cool, Thanks. :thumbsup:
02-03-2005, 06:48 PM
Where do you put the header information as you posted in the code? Just at the top of any page is fine?
02-03-2005, 06:55 PM
In php, at the very top before any whitespace:
header("Cache-control: private, no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Past date
I use a dynamic stylesheet for a styleswitcher, and in addition to the content type, had to add the extra stuff becuase Opera seemed to be caching it and wouldn't reflect changes made to the dynamic stylesheet.
02-03-2005, 06:57 PM
Interesting... but wouldn't that defeat some of the full power of CSS (having to download a new style sheet each time)? The cache is half the fun sometimes:)
PS - thanks for the quick, useful response by the way:)
02-03-2005, 06:59 PM
If it's a large file you're right. But if you're just changing a few rules on the fly it can be handy.
02-03-2005, 08:18 PM
I don't see any benefit in stopping it from caching. For your own development purposes, Shift + Relead is force-refresh in Opera. Users won't have a problem, because it's done once they see it.
02-03-2005, 09:44 PM
For your own development purposes, Shift + Relead is force-refresh in Opera. Users won't have a problem, because it's done once they see it.
I don't think I understand :confused:
I've been using a php styleswitcher (http://www.codingforums.com/showthread.php?t=43097) to switch between three small css files and Opera doesn't reflect the change unless stopping each from caching. This is happening when viewing off the server.
Oh no-no no no no no I don't want to change the existing/familiar functioning of a stylesheet.
Edited for Gobbledegook!
Where I have made a single perl program that enables the creation and presentation of a series of different dining menus, I can determine that each will have its own menu-specific stylesheet.
But I want also, to enable the creation of a stylesheet through the browser so that colors and fonts etc can be altered to suit a specific menu style. Y'see the prog I am using creates flat files with no extension and I wanted to find out if such files could be used as css before I spent more time with this specific script.
Then I want to bring the functionality of eight cms systems together into one package by adding a CP.
I'm some distance off doing the GUI CP because I am overworked on creating and learning more perl programs. :rolleyes:
02-04-2005, 08:05 PM
For my dynamic CSS at my blog, I've got styles in the head element, so the stylesheet remains the same all the time...
02-04-2005, 09:33 PM
I don't think I understand :confused:
I've been using a php styleswitcher (http://www.codingforums.com/showthread.php?t=43097) to switch between three small css files and Opera doesn't reflect the change unless stopping each from caching. This is happening when viewing off the server.That's because according to the browser and the server, you're serving the same file. The idea behind alternate stylesheets is to have different stylesheets that are de/activated by the user. This supports caching. What you need to do is append a variable to the end of the URL
<link rel="stylesheet" href="mystyles.css?colour=blue" type="text/css" media="screen">Then you give it a URL with a different variable to change the style.
I'm fairly sure this works, though I've never bothered with it.