Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [604] Anybody Home?????

Quote Reply
Re: [604] Anybody Home????? In reply to
Thanks, it's working!

I'm now trying to use this code in another area of my website, that pulls photos from another table. I have it set up to the point where it's pulling the photo name (whatever.jpg) from the file column of another table, using this global:

Code:
sub {
my $tags = GT::Template->tags;
my $id = $tags->{ID};
my ($table, $field) = @_;
my $sth = $DB->table($table)->select({ $field => $id});
my $tab = $DB->table($table);
$tab->select_options('ORDER BY Date DESC', 'LIMIT 25');
my $sth = $tab->select({ $field => $id});
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}

What I would like help with, if you can, is changing the above global so that it returns the file path name (such as example: "2/2-filename.jpg") included instead of just the bare filename.jpg

I have the following global which does this perfectly when the file is in the same table:

Code:
sub {
my $tags = GT::Template->tags;
my $id = $tags->{TankID};
my ($table, $image_col) = @_;
my $file = $DB->table($table)->file_info($image_col, $id) or return "ID $id does not have a file attached.";
return $file->File_RelativePath();
}


So again, if you know how to essentially combine these two globals so that the first global returns file path name instead of just the file name, I would really appreciate the help. I have tried so many different combinations of the code to get it to work but haven't had any success. I always just get the "ID $id does not have a file attached." Any ideas?

Also, this will unfortunately only be useful if I can use the loop command on my template to show the file path of all search results. Am I going to be able to do this since it's calculated in a global?

Last edited by:

Dempsey: Sep 19, 2009, 10:46 AM
Subject Author Views Date
Thread Multiple tables in one template bf 23813 Mar 19, 2003, 12:46 PM
Thread Re: [bf] Multiple tables in one template
hennagaijin 23609 Mar 19, 2003, 4:42 PM
Thread Re: [hennagaijin] Multiple tables in one template
bf 23546 Mar 20, 2003, 7:04 AM
Post Re: [bf] Multiple tables in one template
hennagaijin 23493 Mar 20, 2003, 7:19 AM
Thread Re: [bf] Anybody Home?????
bf 23445 Mar 21, 2003, 11:45 AM
Thread Re: [bf] Anybody Home?????
604 23504 Mar 21, 2003, 4:32 PM
Post Re: [TheStone] Anybody Home?????
bf 23471 Mar 23, 2003, 10:28 AM
Thread Re: [604] Anybody Home?????
Dempsey 22744 Sep 1, 2009, 9:29 PM
Thread Re: [Dempsey] Anybody Home?????
Dempsey 22712 Sep 5, 2009, 2:45 PM
Thread Re: [Dempsey] Anybody Home?????
Dempsey 22710 Sep 6, 2009, 9:45 PM
Thread Re: [Dempsey] Anybody Home?????
604 22658 Sep 11, 2009, 9:37 AM
Post Re: [604] Anybody Home?????
Dempsey 22629 Sep 12, 2009, 1:15 PM
Thread Re: [604] Anybody Home?????
Dempsey 22572 Sep 17, 2009, 9:51 PM
Thread Re: [Dempsey] Anybody Home?????
604 22544 Sep 18, 2009, 8:59 AM
Thread Re: [604] Anybody Home?????
Dempsey 22533 Sep 19, 2009, 10:31 AM
Post Re: [Dempsey] Anybody Home?????
Dempsey 22415 Sep 23, 2009, 9:51 PM
Thread Re: [604] Anybody Home?????
Dempsey 22723 Sep 9, 2009, 8:57 PM
Post Re: [Dempsey] Anybody Home?????
Dempsey 22667 Sep 11, 2009, 12:05 AM