Greets Folks,

I'm going to phrase this question on link generation
in two different ways: barebones and elegantly.  You
can answer as you wish, and if you wish.

BareBones - Can I "nest" a template tag in an HTML tag
to make a link? Sort of like this:

<a
href=http://www.blah.com/cgi-bin/blah.pl?id=<TMPL_VAR
NAME="id">>

I wanted to ask to see if it will work before trying
it.

Elegantly - I have been studying a program which
generates links like this:

#####EXAMPLE_ONE#####

sub display_item
{
my $row = shift;
my ($edit_url, $delete_url);

$edit_url = sprintf ("%s?choice=edit;id=%d", url (),
$row->{id});
$delete_url = sprintf ("%s?choice=delete;id=%d", url
(), $row->{id});
print br (), br (),
"$row->{t} $row->{status}"," [", a ({-href =>
$edit_url}, "Edit"), "]", 
" [", a ({-href => $delete_url}, "Delete"), "]", br
(), "\n",
escapeHTML ($row->{content}), "\n";
}

However, I am having difficulty translating something
like this into HTML::Templated terms because I have
been using the following loops to create my variables
for templates:

#####EXAMPLE2#####

my @array = ();
my $template = HTML::Template->new(filename =>
'table.tmpl');
my $dbh = DBI->connect(#######{PrintError => 0,
RaiseError => 1});
my $sth = $dbh->prepare("SELECT yadda1, yadda2, yadda3
FROM three");
$sth->execute();
while (my $row = $sth->fetchrow_hashref())
{
     push @array, $row;
}
$template->param(list=>\@array);

I like the way example one works, but it doesnt use
H::T.  The above table (example 2) uses H::T, but it
doesnt have any links in it, so I am trying to figure
out a way to get H::T to help generate links inside a
loop.

Any advice?

TIA,

Will


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to