Fri, 23 Jan 2004 16:54:00 -0500
|
Several days ago, I posted a message asking whether anyone had done this. The
response was underwhelming. A couple of people expressed interest, but no one
admitted ever having tried it.
Never one to recognize that there might be a good reason that the path is
unbeaten, I decided to try it anyway. I am here to report that it works, and
the conversion process is neither as complex nor as time-consuming as you
might think.
The process:
1. I copied the contents of the dynamic and static 'style sheet' template for
each theme into seperate .css files, and verified that the style sheets for
static pages are identical to the style sheets for dynamic pages. I suspected
they would be, but I wanted to be sure. I have a single .css file for each
theme. These files are located in the web archives directory.
The style sheet templates contain several comments with LISTSERV-style
comment delimiters. I changed the delimiters to valid CSS comment
delimiters in the external .css files.
One directive in each style sheet identifies the image to use as the bullet
in lists on 'wizard' pages. In the template, the URL includes a variable
which resolves to 'ls1', 'ls2', or 'ls3' (the image set identifier). In the
external .css file, I hard-coded this directive to use the image in the ls2
image set, because I am using the ls2 image set throughout the site. If I
change the image set in $WWW_IMAGE_URL, I will need to change this directive
in each .css file. This particular issue could be eliminated by moving this
directive from an external .css file to an internal <style> block.
I made no other changes to the style directives; I simply moved them from
embedded templates to external .css files.
2. I replaced the contents of each theme-specific 'style sheet' template with a
<link> statement referencing the appropriate .css file. Example:
<link rel="stylesheet" href="/archives/theme1.css" type="text/css">
3. I removed the <style> and </style> tags surrounding the .IM command for the
theme-specific style sheet template in the $WWW_STYLE_SHEET and STYLE_SHEET
templates.
4. I forced LISTSERV to recreate the static pages (normally recreated daily)
using the new templates. I shutdown the LISTSERV process, erased the .html
files in the web archives directory, then restarted the LISTSERV process.
The .html files were generated during the LISTSERV initialization process.
The results:
I eliminated approximately 75 lines of hard-coded style directives from *EVERY
PAGE* generated by the web interface, without changing the look and feel of the
web site.
I also customized the top banner and removed the 'welcome' banner on the home
page, but those changes were in no way related to the migration of style
directives to external .css files.
You can see a working example at <http://testlist.cc.nd.edu/>.
--
Paul Russell
Senior Systems Administrator
University of Notre Dame
|
|
|