[Bese-devel] How to use tal-templates
astor at pvv.ntnu.no
astor at pvv.ntnu.no
Mon Aug 15 15:34:45 UTC 2005
On Mon, Aug 15, 2005 at 03:25:38PM +0200, Marco Baringer wrote:
>
> currenlty we don't have a way for a nested componnet to affect the
> tags generated by the window component, nor do we have an already
> existing mechanism which would allow this.
>
> would it be worth the effort to make simple-window-component (or
> something) walk the component tree before the render-on phase and
> collect extra head headers (like script or even meta or link)?
>
I think so. But just to complete the picture, I can think of the
following use-cases:
o Sometimes you want to place supporting javascript in HEAD. This is
the proper way to ensure that they are available. Putting the script
in BODY could often be buggy since the code might not be available
when an event fires in the javascript world.
o Sometimes a component might want to place supporting javascript in
HEAD _once_ even if the component is rendered multiple times.
(maybe a property-like interface would be good for this stuff).
o Maybe a component would like to produce an "external"
.js-file for that particular component and refer to that .js-file
_once_ in HEAD if the component is being used. This could be a good
solution for complex components (AJAX maybe).
o Sometimes you want to put javascript in BODY, but AFAIK, that will
typically not be code that simply defines functions, but rather code
that does stuff, like your alert example. But this is supported
rather well already I think.
So to me it seems like a component might want to produce:
o Global code (external .js-file)
o Per request, "per instance" code in HEAD.
o Per request, "per instance" code in BODY.
o Per request, "per class" code in HEAD.
astor
More information about the bese-devel
mailing list