Hi Chris,
I am assuming that this snippets of script/template are not exactly the same as your
real code?
If so, you reeeealllly should be calling 'use strict;' since I can see that there are
vairable definitions here that are not declared before use. Perl will quite happily
do this, thus auto-vivifying some of these variables into globals - probably not what
you really want to happen.
Also, didn't you say that you were using HTML::Template::Expr
> my $template = HTML::Template->new(filename => 'index.tmpl', strict =>
> 0,global_vars => 1);
> I really dont know why H::T is complaining about finding a <//TMPL_IF>
> without a <TMPL_IF>, since there is, indeed one there.
This complaint was because I told you to use "strict => 0" thus H::T is ignoring the
<TMPL_IF EXPR....>, thus hitting the </TMPL_IF> without finding the <TMPL_IF...>.
Ignore this - this was expected, and thus confirmed that the error was with the
TMPL_IF.
Try using H::T::E rather than H::T ?
Mat
> I will include my HTML template and source:
>
> HTML Template:
> <TMPL_LOOP ROWS>
> <br>
> <br>
> <TMPL_VAR NAME=MODEL_NAME>
> <br>
> <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100>
> <br>
> Can be seen at:
> <TMPL_LOOP URLLOOP>
> Model Name: <TMPL_VAR NAME=MODEL_NAME>
> Model Comp: <TMPL_VAR NAME=MODEL_COMP>
> <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME">
> Model Name: <TMPL_VAR NAME=MODEL_NAME>
> Model Comp: <TMPL_VAR NAME=MODEL_COMP>
> The URL on match: <TMPL_VAR NAME=MODEL_URL>
> </TMPL_IF>
> </TMPL_LOOP>
> </TMPL_LOOP>
> <br>
>
>
> The Perl Script:
> #!/usr/bin/perl
> use DBI;
> use CGI;
> use HTML::Template;
> use HTML::Template::Expr;
>
> my $dbsource = "DBI:mysql:dbname=msearch;host=localhost";
> my $dbuser = "chrisp";
> my $dbpasswd = "xxxxxxxx";
>
> my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0,
> global_vars => 1);
> my $bychar = 'c';
> my @URLS = ();
> my @ROWS = ();
>
> my $dbh = DBI->connect($dbsource, $dbuser, $dbpasswd);
> my $dbh2 = DBI->connect($dbsource, $dbuser, $dbpasswd);
>
> my $query = "SELECT DISTINCT model_name as model_name, model_thumb FROM models WHERE
> model_firstchar = '$bychar' GROUP BY model_name";
> my $sth = $dbh->prepare($query);
> $sth->execute() || die &error($DBI::errstr);
>
> while (my $data = $sth->fetchrow_hashref) {
> $model_name = $data->{model_name};
>
> my $query2 = "SELECT model_url FROM models where model_name =
> '$model_name'";
> my $sth2 = $dbh2->prepare($query2);
>
> $sth2->execute();
> $sth2->bind_columns(undef, \$model_url);
>
> while($sth2->fetch()) {
> push (@URLS,
> {
> MODEL_URL => $model_url,
> MODEL_COMP => $data->{model_name}
> }
);
> }
>
> push (@ROWS,
> {
> MODEL_NAME => $data->{model_name},
> MODEL_THUMB => $data->{model_thumb},
> URLLOOP => [EMAIL PROTECTED],
> }
> );
> }
>
> $sth->finish();
>
> $template->param( ROWS => [EMAIL PROTECTED] );
> print $template->output;
>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users