Half a croissant, on a plate, with a sign in front of it saying '50c'

h a l f b a k e r y
Just add oughta.

idea: add, search, annotate, link, view, overview, recent, by name, best, random

meta: news, help, about, links, report a problem

account: Browse anonymously, or get an account and write.

User:
Pass:

or Create a new account.


                  Please log in.
If you're not logged in, you can see what this page looks like, but you will not be able to add anything.

CSS Includes
Integrate Server-side Includes into CSS spec
  (-3)
(-3)
  [vote for,
against]


This may simply be a case of me masquerading an old idea as a new one due to my own ignorance, but here goes:

If you're a web designer, you have undoubtedly used cascading style sheets in order to improve your sites separation of form and content. You probably also use Server-side include files to include snippets of content-building code.

I was thinking, how about adding a reference to an ASP or PHP include file directly in the style sheet. It would be similar to the BEHAVIOR attribute except that it would allow reference to a server-side script.

CSS:

.datebox {behaviour:url('getdatepopup.htc')} /* possible */

#sidebar {include:url('myfavoriteblogs.asp')} /* impossible? */

OLD MARKUP:

<div id=sidebar> <!-- #include file="myfavoriteblogs.asp" --> </div>

NEW MARKUP:

<div id=sidebar />

Even better if you could include multiple CSS references in display order:

#sidebar {include:url('latestposts.asp');include:url('myfavoriteblogs.asp')}

Can you imagine how clean your markup would be if this were possible?


mlanza, Jun 26 2004


Short name, e.g., Bob's Coffee

Destination URL. E.g., http://www.coffee.com/

Description (displayed with the short name and URL.)







       Damn....after reading that, I'm bleeding from the ears. I have no idea what you just said.

Pocketassreturn, Jun 27 2004
  

       The trouble is that PHP and ASP are, as you're obviously aware, executed on the server and simply present the resulting HTML to the browser. The actions of CSS are performed on the browser, and I'm not sure the two could be combined in the way that you intend. Having said which, I'm no expert.

angel, Jun 27 2004
  

       I'm pretty sure this doesn't work in any existing browsers, and I'm not even sure it's *supposed* to work, but this seems logical:   

       #sidebar::before { content: url('foo.html'); }   

       It's basically an extension of the content property to be able to use the contents of an HTML (or workalike, eg PHP) file. Right now (well, in CSS3) you can put in literal strings, counters, and external resources like images, but not structured documents (AFAIK).

polveroj, Jul 05 2004
  

       That explains why my ears are bleeding....it's tough being conversant, but not fluent.

normzone, Jul 05 2004
  

       [understanding dawns. deletes text]
Hmmm. So, once you've separated your content and style, putting the content into the HTML and the style into the CSS, you want to start putting content into the CSS. Isn't this known as "muddying the waters".

st3f, Jul 06 2004
  

       ASP is stripped out of the script files before being executed (hence the need for <% .. %> tags), which is why you can't dynamically include files, or rely on any script calling them. CSS is client based, and so would be impossible to implement with the current http & ASP system. Also, if you're just going to statically include a script at different points, why not use <!--#include? It ain't that long...

Extreme Tomato, Jul 30 2005
  

       Your favourite blogs is content, not styling, I can't see why you'd want to mix yur content in with your styling.

zapped, Feb 07 2006
  


 
back: main index
 business 
 computer 
 culture 
 fashion 
 food 
 halfbakery 
 home 
 other 
 product 
 public 
 science 
 sport 
 vehicle