Hi everyone,

    I'm probably overlooking something or maybe i did not understanding very
well.i've been trying to do like the mail below and like i saw on the docs
about that HTml::Template.i can't see where i pass the parameter value and
keyword in <TMPL_VAR NAME>.I'm pretty sure i have the values in @data. i put
the code below just to show what i'm trying to do.Can someone help me with
that.Tks in advance
Fabio


the tmpl page

<select name="branch" size="1" class=borda>
<TMPL_LOOP name="DATA">
<option value=<TMPL_VAR NAME="VALUE">> <TMPL_VAR NAME="KEYWORD"></option>

</TMPL_LOOP>
</select>


the cgi code

$sql = "select * from T_BRANCH";

ConnectDb();

$template = HTML::Template->new(filename=>$PathLogin);
while (@data = $sth->fetchrow_array()) {
$template->param(DATA=>\@data);
}
print $template->output;

$sth->finish or die "Couldn't finish the statement :" . $dbh->errstr;;
$dbh->disconnect or die "Couldn't disconnect the database :" .
$dbh->errstr;;










Fabio Quintao
[EMAIL PROTECTED]
www.clikimoveis.com.br
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, November 23, 2001 8:20 AM
Subject: RE: Html::template Problem


> Hello,
>
> the easiest way is IMHO to use a template loop.
>
> <select ...>
> <TMPL_LOOP name="select">
>     <option value="<TMPL_VAR NAME="value">"><TMPL_VAR
> NAME="keyword"></option>
>     ...
> </TMPL_LOOP>
> </select>
>
> Therefore the data format should be something like this:
>
> @data = ({value => "1", keyword => "A"}, ...)
>
> And the usage is the following:
>
> $tmpl->param(select => \@data);
>
> You could get more in depth information on template loop in the package
> manual.
>
> HTH
>
> regards
>
> Thorsten Klein
>
> IT-Consultant/Web-Developer
> GWV Fachverlage: Gabler.Vieweg. WV.Teubner
> Abraham-Lincoln-Str. 46
> D-65189 Wiesbaden
> fon: +49 611 7878-601
> fax: +49 611 7878-78 601
>
>
>
> -----Original Message-----
> From: Perl ++ [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 21, 2001 3:15 AM
> To: webperl
> Subject: Html::template Problem
>
>
> HI all.
>
>     I'm doing a script that uses Html::Template however there's something
> that i need to do that i don't know if i can do with that.I'm selecting
> fields from an Oracle table and put everything inside of a hash like the
> example below.i  have a .tmpl file with a combobox that i need to be filed
> automaticaly with the values that its inside of the hash.
>
> %data = ('1','A','2','B','3','C','4','D');
>
>
> i need to put in my template .tmpl file like this
> <select name="branch" size="1" class=borda>
> <option value="1">A</OPTION>
>
> <option value="2">B</OPTION>
>
> <option value="3">C</OPTION>
>
> <option value="4">D</OPTION>
>
> </select>
>
>     can i do that using Html::Template, if yes how can i do that?if not
what
> can i use?
>     I Hope someone can help me
> tks in advance
>
> Fabio Quintao
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> www.clikimoveis.com.br <http://www.clikimoveis.com.br>
>
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
>
>

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to