Is anyone using stylesheets with TT?
Yes, and it's not difficult. Here's an example: http://www.gnubis.com.br/cgi-local/crm/bin/crm.pl?template=pg_sel_contact
Nelson, thanks much, the example is really nice. Makes me wish there were a place to post lots of example code for TT showing good programming style.
It could be useful!
I'm a slight bit dense on one point. In your header.tt2 you have:
<head> <title>[% title %]</title> <style type="text/css" media="all"> @import "/inc/crm.css"; </style> </head>
I'm used to seeing a stylesheet called in like so:
<link rel="stylesheet" href="style.css" type="text/css" />
So I'm puzzling over what the '@import' array is doing. Does it contain the stylesheet contents? If so, what's the "/inc/crm.css" for? A placeholder, an element the browser expects?
The @import is not an array; it's just a fancy way to call the stylesheet which is located at "/inc/crm.css".
From the W3C specification:
The '@import' rule allows users to import style rules from other style sheets. Any @import rules must precede all rule sets in a style sheet. The '@import' keyword must be followed by the URI of the style sheet to include. A string is also allowed; it will be interpreted as if it had url(...) around it.
Example(s):
The following lines are equivalent in meaning and illustrate both '@import' syntaxes (one with "url()" and one with a bare string):
@import "mystyle.css";
@import url("mystyle.css");So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media types after the URI.
Example(s):
The following rules have the same effect as if the imported style sheet were wrapped in an @media rule for the same media, but it may save the UA a fruitless download.
@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;In the absence of any media types, the import is unconditional. Specifying 'all' for the medium has the same effect.
-- []s
Nelson
________________________________________________________________ Nelson Ferraz
GNU BIS: http://www.gnubis.com.br PhPerl: http://www.phperl.com
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
