I am using this code in my html file:-

<address>Last Modified <!--#config errmsg="Yesterday" --><!--#config timefmt="%A %d %B %Y" --><!--#flastmod file="index.html" -->
</address>

Is there a way i can put this in my stylesheet to save me doing it on each page?
thanks :)

Recommended Answers

All 5 Replies

No, but look at SSI (server side includes)

Thanks for the short reply, I guess your really busy.

I have of course looked into SSI (Server Side Includes) as that's exactly what this code is based on.

What is it about the SSI's I have missed that you are implying that could solve this situation?

You can include any file you want using server side includes to avoid duplication of code. For eg. each page of a website has a common header and footer section. Instead of repeating the code, the header and footer sections are stored in separate files and included in every page using your favourite server side language.

In J2EE, the common code is put in a .inc file if it contains static content and in .jsp if it contains dynamic content. Then by using the line:

//somepage.jsp

<html>
<body>
  <%@include file="header.inc" %>
  <div>Hello</div>
</body>
</html>

I am pretty sure there must be a similar construct in the server side language you are employing to get the job done.

You can make CSS files server parsed... Either as SSI with an Apache htaccess directive, or using some other server language to generate the CSS file automatically.

You can include arbitrary text through CSS using the 'content' property in newer browsers; i.e:

<html>
<head>
<style type="text/css">
.placeholder
{
  content: "hello!";
}
</style>
</head>
<body>
<span class="placeholder">...</span>
</body>
</html>

! This doesn't work on IE <= 6; no idea about 7.

However; importantly: the 'date modified' reported if you server-parse certain CSS is going to be the date that the CSS file was modified, not the date that any individual document that links the CSS was modified.

If you want to server parse all CSS:

AddHandler server-parsed .css

Doing the above should allow you to write <!--# --> blocks in your CSS, as you would in shtml.

If you want to parse SOME CSS, ( I used to use SSI to server-parse XML files called ssixml, and ssixsl [ if you wonder; 'why not sxml?'; try pronouncing it with <=3 syllables ] ).

It's probably better to make a custom name than server parse ALL CSS files, server parsing takes some amount of time and processing; in this example, all files with extension 'ssicss' will be server parsed. The AddType line is important because some newer browsers choke on CSS/JS served as text/html...

AddType text/css .ssicss
AddHandler server-parsed .ssicss

In both cases, that information can be added to some .htaccess file that will be read for a given CSS request... This does assume that you have Apache as your server daemon, that you have the necessary mods installed, and that you have permission to use those mods..

If you just get errors, but think you should be allowed to use those mods, try putting this line first in the .htaccess:

Options +FileInfo

http://httpd.apache.org/docs/1.3/mod/mod_mime.html

now thats what i call a response, thanks so much for your help, this has given me loads to go on. most importantly of all, thanks to Matt Evans for this:-

"However; importantly: the 'date modified' reported if you server-parse certain CSS is going to be the date that the CSS file was modified, not the date that any individual document that links the CSS was modified."

I hadn't considered that and of course I can't do it then ;)

There is plenty of information here however that will help me reduce a lot of work, thanks again :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.