hi,
I've sent this email to Template-Toolkit mailing list... but there doesn't
seem to be anyone, so I'm sending it here ... Could anyone help me out with
these


ok I have two questions about TT, let me begin with the
first one the easier ...

I have the folowing situations I have a template like this


$vars = {
    stuff => 'filename.tpl'
};

then in the parent template


[% INCLUDE $stuff %]

Ok the problem is that sometimes I generate the contens on the fly so I can
have in $stuff not the file name, but the content itself i.e.

$vars = {
    stuff => '<table><tr><td>blah</td></tr></table>'
}

i.e. I need [% $stuff %] not [% INCLUDE $stuff %]

How can in the parent template distinguish between these two cases....  (if
scalar place it, if file include it ).
There is third case what if it is scalar-template -> then we have to
parse/process the scalar..


Now the SECOND question :

This is mostly related to FORMS ( i've done one module that generate for me
forms content, insert/update queries, filled forms from a common config
file), so what I need ... I need a way to replace the web-designer
inputs,select boxes, textareas with thouse generated from me, but also want
to preserve the formating/styles etc.. f.e.

Designer wrote (the idea is ):

<select name=blah size=10 style="...">
    <option ...>...
    <option ...>...
    <option ...>...
</select>
<input type=text size=10 class=blah>

I have to remove <select> & <input> but preserve the "size", "style" and
"class" -> replace name with "name" created by me -> and extract input-type
for further usage in my script... Also I'm populating the SELECT-options
from the DB so I must replace the designers-made with mine.
it has to be some sort of callback function that will be called every time
the TT hit some form-element...
I thought of several variants with using WRAPPER, BLOCK.. !?! which doesn't
help me alot.... possibly this has to be some sort of FILTER ?! has to have
the ability to get arguments !?!?
May be :

[%FILTER parse(tplname=myslect, size=10, style="...")%]
<select name=blah size=10 style="...">
    <option ...>...
    <option ...>...
    <option ...>...
</select>
[%END%]
[%FILTER parse(tplname=myin, size=12, class=blah)%]
<input type=text size=12 class=blah>
[%END%]


Please help me... i haven't written a filter !?! is there any other solution
!?!?
Thanx alot
=====
iVAN
[EMAIL PROTECTED]
=====



Reply via email to