| | |
inserting code in css stylesheet
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I am using this code in my html file:-
Is there a way i can put this in my stylesheet to save me doing it on each page?
thanks
HTML and CSS Syntax (Toggle Plain Text)
<address>Last Modified <!--#config errmsg="Yesterday" --><!--#config timefmt="%A %d %B %Y" --><!--#flastmod file="index.html" --> </address>
thanks
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?
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:
I am pretty sure there must be a similar construct in the server side language you are employing to get the job done.
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:
HTML and CSS Syntax (Toggle Plain Text)
//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.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
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:
! 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:
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...
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:
http://httpd.apache.org/docs/1.3/mod/mod_mime.html
You can include arbitrary text through CSS using the 'content' property in newer browsers; i.e:
html Syntax (Toggle Plain Text)
<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:
HTML and CSS Syntax (Toggle Plain Text)
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...
HTML and CSS Syntax (Toggle Plain Text)
AddType text/css .ssicss AddHandler server-parsed .ssicss
If you just get errors, but think you should be allowed to use those mods, try putting this line first in the .htaccess:
HTML and CSS Syntax (Toggle Plain Text)
Options +FileInfo
Last edited by MattEvans; Jul 2nd, 2007 at 9:36 pm.
Plato forgot the nullahedron..
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
"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
![]() |
Similar Threads
- centring an image in a css stylesheet (HTML and CSS)
- CSS stylesheet layout (HTML and CSS)
- Random CSS Stylesheet selector exists? (JavaScript / DHTML / AJAX)
Other Threads in the HTML and CSS Forum
- Previous Thread: almost liquid design: navbar extend
- Next Thread: how creat website
Views: 2762 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart center cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format free frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl






