Forum OpenACS Q&A: Re: Arbitrary Template File Extensions

Collapse
Posted by Ralph Hempel on
Dave wrote:

"The whole point of CSS is that a class would be universally defined for your site."

Exactly - except I want blue paragraphs in one part of my site and orange in another. And if I move the source files from one part of my site to the other, I don't want to have to change the class names.

I think I'll succumb to the general weight of advice here and not try and process the css files through the template system. I'll generate them another way. They all have the same source, the same tags and attributes. Only some of the attribute values change between the css files in different parts of the site.

It was soooo tempting to make the changes happen automagically.....

Thanks for all the advice so far.

Collapse
Posted by Mat Kovach on
Of course, you could put something in the master templated that picks the css files based on site_id, or package_id, etc.

Add something like:

in the master .tcl

set package_id [ad_conn package_id]

if { css file doe snot exists for package_id }
  set css_file "default.css"
else
  set css_file "package_id.css"

then in master.adp

<link href="/templates/@css_file@" rel="sytlesheet" type="text/css">

You would just have to logic for the decieding on which css file to use.

Collapse
Posted by Ralph Hempel on
Yep, that will work just fine. And I could even generate the css file dynamically and make sure it's in the file system before the current page is returned.

That way the browser can fetch it (as needed) and the css file will have automatically generated values.

I could also just leave the CSS file as a static file....

Collapse
Posted by Jarkko Laine on
Maybe you can even make a vuh file that is being called in Mat's solution instead of static css files (in case you really want to create the css just-in-time).

It could then do whatever smart logic you want it to do.