On Tue, Feb 17, 2009 at 12:08, Tino Wildenhain <tino@wildenhain.de> wrote:
You should really not generate CSS ;) And JS is best generated with Jason :-)
You need to generate CSS when you want to use absolute paths for images referred to in your CSS. This can easily be done with ZPT: <tal:css define="portal python:request['PARENTS'][1]; portal_url portal/portal_url" replace="string: .ac_loading { background: white url('$portal_url/spinner.gif') right center no-repeat; } " /> The above code snippet is taken from a current project; the portal_url dance is there because this is a browser:resource template and such a template only has access to the request, not a context. We also generate some JS to provide client-side code with translated labels. Alternatively you can do this with hidden elements in your main template as well, but the generated JS way was more maintainable as this keeps the labels and the code close together. -- Martijn Pieters