My Gmail sent that message before I was done typing...I hit some wrong button....(WONDEFUL keyboard short cuts!!)
I meant to finish... I have something very similar, I use for including Google Maps. What I do, is just use the same test that was preformed for including MyButton.html. eg: <html> <head> <!-- includes go here --> [% IF something() %] <script src="MyButton-impl.js" .../> [% END %] </head> <body> [% IF something() %] [% INCLUDE MyButton.html %] [% END %] </body> </html> I have actually made a whole bunch of javascript templates, and pick and choose which ones get included. I see no reason to have external js links, with a template system, other than "hiding code". Back in the day, it was nice to be able to edit one js file, and all pages change. With Templates that's obsolete. I edit the template, and everywhere it was included changes... I believe it's faster to have the js inline, right in the head of the doc (or body, I use CDATA for that...) I'm interested on others thoughts on this? Am i missing something? As for hiding code, I've found (when sharking) that you can almost always copy the link to the js file, and paste into your browser, to see the javascript anyway. What would be the advantage of using external js files, with template sytems? On Mon, Feb 16, 2009 at 3:22 PM, sean <sean_in_rale...@yahoo.com> wrote: > > 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 > templates@template-toolkit.org > http://mail.template-toolkit.org/mailman/listinfo/templates > -- Kelly Thompson Vice President Live Audio Magazine Inc. www.liveaudiomag.com (919) 389-5784
_______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates