inserting code in css stylesheet

Thread Solved

Join Date: Apr 2007
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

inserting code in css stylesheet

 
0
  #1
Jun 30th, 2007
I am using this code in my html file:-
HTML and CSS Syntax (Toggle Plain Text)
  1. <address>Last Modified <!--#config errmsg="Yesterday" --><!--#config timefmt="%A %d %B %Y" --><!--#flastmod file="index.html" -->
  2. </address>
Is there a way i can put this in my stylesheet to save me doing it on each page?
thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2
Reputation: Techpedia is an unknown quantity at this point 
Solved Threads: 1
Techpedia Techpedia is offline Offline
Newbie Poster

Re: inserting code in css stylesheet

 
0
  #2
Jun 30th, 2007
No, but look at SSI (server side includes)
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

Re: inserting code in css stylesheet

 
0
  #3
Jun 30th, 2007
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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,652
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: inserting code in css stylesheet

 
0
  #4
Jul 1st, 2007
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:

HTML and CSS Syntax (Toggle Plain Text)
  1. //somepage.jsp
  2.  
  3. <html>
  4. <body>
  5. <%@include file="header.inc" %>
  6. <div>Hello</div>
  7. </body>
  8. </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
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: inserting code in css stylesheet

 
0
  #5
Jul 2nd, 2007
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:

  1. <html>
  2. <head>
  3. <style type="text/css">
  4. .placeholder
  5. {
  6. content: "hello!";
  7. }
  8. </style>
  9. </head>
  10. <body>
  11. <span class="placeholder">...</span>
  12. </body>
  13. </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)
  1. 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)
  1. AddType text/css .ssicss
  2. 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:
HTML and CSS Syntax (Toggle Plain Text)
  1. Options +FileInfo
http://httpd.apache.org/docs/1.3/mod/mod_mime.html
Last edited by MattEvans; Jul 2nd, 2007 at 9:36 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

Re: inserting code in css stylesheet

 
0
  #6
Jul 3rd, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum


Views: 2762 | Replies: 5
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC