Hi, and thanks for TT,

I'm wondering what is the best way to include
information from later templates in a given
template.  For example, let's say I have
an HTML page like:

    <html>
        <head>
            <!-- includes go here -->
        </head>
        <body>
            [% IF something() %]
                [% INCLUDE MyButton.html %]
            [% END %]
        </body>
    </html>

and MyButton.html looks like:

    <input onclick="do_something()" .../>


What I want is to have the following line
added to the "includes go here" section
in the head of the main document:

    <script src="MyButton-impl.js" .../>

if and only if the MyButton.html template
was INCLUDEd.

I was thinking that something like this:

    [% INCLUDE_TIME_HOOK my_javascript_includes.push("MyButton-impl.js") %]

in the MyButton.html template, and then a
FOREACH across that list in the <head> section
would do it, but I haven't been able to
find such a directive.

Is there a way to get this behavior?

Thanks,
Sean





      

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to