I've found another interesting inflection point is the 'associate'
parameter given to the template constructor. Associate
tells the template that another object has a 'param' method that acts
like the one in CGI.pm: called with args its a setter, called without
args in a list context returns a list of parameter names that are
provided by the object. Thus the code using the template can do
some passive relection of templates by making a crafty 'param' method.<br>
<br>
I'll send out examples if I'm able to cobble up anything promising.<br>
<br>
Meanwhile, thanks again Austin Mongers!<br>
<br>
-Bill<br><br><div><span class="gmail_quote">On 9/8/05, <b class="gmail_sendername">Bill Raty</b> <<a href="mailto:bill.raty@gmail.com">bill.raty@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks Wayne.<br>
<br>
Aha! I may get away with it using the 'filters'. Also the special loop vars look promising:<br>
<br>
<br>
<pre><TMPL_LOOP NAME="FOO"><br> <TMPL_IF NAME="__first__"><br> This only outputs on the first pass.<br> </TMPL_IF><br><br> <TMPL_IF NAME="__odd__">
<br><br> This outputs every other pass, on the odd passes.<br> </TMPL_IF><br><br> <TMPL_UNLESS NAME="__odd__"><br> This outputs every other pass, on the even passes.<br> </TMPL_IF>
<br><br><br> <TMPL_IF NAME="__inner__"><br> This outputs on passes that are neither first nor last.<br> </TMPL_IF><br><br> This is pass number <TMPL_VAR NAME="__counter__">.
<br><br><br> <TMPL_IF NAME="__last__"><br> This only outputs on the last pass.<br> <TMPL_IF><br><br><br> </TMPL_LOOP></pre>
<br>
It still seems to require that the template writer to know too much about inclusions or adhere to a convention.<br><span class="sg">
<br>
-Bill</span><div><span class="e" id="q_10638c17c5e9b887_2"><br>
<pre><br></pre>
<br>
<br>
<br><br><div><span class="gmail_quote">On 9/8/05, <b class="gmail_sendername">Wayne Walker</b> <<a href="mailto:wwalker@bybent.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">wwalker@bybent.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You can do this with TMPL_IF and TMPL_INCLUDE<br><head><br> <tmpl_if name=calendar_present><br> <tmpl_include name="path/to/cal.js"><br> </tmpl_if><br></head><br><body><br>
stuff<br> <tmpl_if name=calendar_present><br> <div .....><br> </tmpl_if><br></body><br><br>This requires that you set calendar_present=1 in the calling program.<br><br>Since I'm not sure what decides if the calendar ends up in the
<br>container, I can't guess further<br><br><br>On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:<br>><br>> I'm trying not to reinvent the wheel, but I'm having difficulty determining<br>> if the wheel I'm needing has been invented.
<br>><br>> I've looked at HTML::Template POD, and I get the basic concept. In my<br>> ignorance I'm failing to see how I can apply it to my problem, and ifthere<br>> are other CPAN modules that are better suited to my task.
<br>><br>> I want to have a DWIMy page component system so that page controls can be<br>> called out and "Do The Right Thing". Example:<br>><br>> I have a calendar input widget
set that requires pieces of HTML,<br>> JavaScript, and CSS, which need to be exposed in the container page; a<br>> script tag in the "head", a 'div' that needs to appear early on inside the<br>> "body" tag, and the 'input' tag that has event handlers that usethe earlier
<br>> script tag.<br>> I'd like a system that abstract the container page, that lets me develop the<br>> calendar control component as if it were the containing page, but when<br>> added/included/embedded in the container page the system smartly places the
<br>> control component elements in the correct part of the containing page. The<br>> clincher is the second add of the calendar widget doesn't duplicate the<br>> 'script' and 'div' tags, but only interjects the 'input' tag for the second
<br>> control.<br><br>> _______________________________________________<br>> Austin mailing list<br>> <a href="mailto:Austin@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Austin@pm.org
</a><br>> <a href="http://mail.pm.org/mailman/listinfo/austin" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.pm.org/mailman/listinfo/austin</a><br><br>--<br><br>Wayne Walker<br><br><a href="mailto:wwalker@bybent.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">wwalker@bybent.com</a> Do
you use Linux?!<br><a href="http://www.bybent.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.bybent.com</a>
Get Counted! <a href="http://counter.li.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://counter.li.org/</a><br>Perl - <a href="http://www.perl.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.perl.org/</a> Perl User Groups - <a href="http://www.pm.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.pm.org/</a>
<br>Jabber: <a href="mailto:wwalker@jabber.gnumber.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">wwalker@jabber.gnumber.com</a> AIM: lwwalkerbybent<br>IRC: wwalker on <a href="http://freenode.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
freenode.net</a><br>_______________________________________________
<br>Austin mailing list<br><a href="mailto:Austin@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Austin@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/austin" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.pm.org/mailman/listinfo/austin</a><br></blockquote></div><br>
</span></div></blockquote></div><br>