Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [kevinws] best way to display a db image in custom templates

Quote Reply
Re: [kevinws] best way to display a db image in custom templates In reply to
I assume that you have two tables:

tableA (CodeID, .....)
tableB (ID, file_name (file field),..CodeID);

In this case one record in tableA could have multiple images in tableB.

and a global:

sub {
my $codeid = shift;
my $results = $DB->table('tableB')->select({ CodeID => $codeid }, ['ID'])->fetchall_hashref;
return { loop_images => $results, hit_images => $#$results + 1 };
}

Now, the html code should be:

<%loop results%>
<%global_name($CodeID)%>
<%if hit_images%>
<%loop loop_images%>
<img src="db.cgi?db=tableB&do=view_file&cn=<%image_column%>&id=<%ID%>">
<%endloop%>
<%endif%>
<%endloop%>

Hope that helps.

TheStone.

B.
Subject Author Views Date
Thread best way to display a db image in custom templates hennagaijin 4707 Jan 24, 2003, 2:56 PM
Thread Re: [hennagaijin] best way to display a db image in custom templates
604 4593 Jan 24, 2003, 3:11 PM
Thread Re: [TheStone] best way to display a db image in custom templates
hennagaijin 4592 Jan 25, 2003, 5:16 AM
Post Re: [hennagaijin] best way to display a db image in custom templates
hennagaijin 4541 Feb 4, 2003, 9:48 AM
Thread Re: [TheStone] best way to display a db image in custom templates
kevinws 4390 Oct 30, 2003, 10:46 AM
Post Re: [kevinws] best way to display a db image in custom templates
604 4399 Oct 30, 2003, 11:02 AM
Thread Re: [kevinws] best way to display a db image in custom templates
Luc1 4387 Oct 30, 2003, 11:07 AM
Post Re: [Luc1] best way to display a db image in custom templates
kevinws 4388 Oct 30, 2003, 11:41 AM
Thread Re: [Luc1] best way to display a db image in custom templates
kevinws 4371 Oct 30, 2003, 11:49 AM
Post Re: [kevinws] best way to display a db image in custom templates
604 4361 Oct 30, 2003, 4:36 PM