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 23721 Mar 19, 2003, 12:46 PM
Thread Re: [bf] Multiple tables in one template
hennagaijin 23516 Mar 19, 2003, 4:42 PM
Thread Re: [hennagaijin] Multiple tables in one template
bf 23454 Mar 20, 2003, 7:04 AM
Post Re: [bf] Multiple tables in one template
hennagaijin 23401 Mar 20, 2003, 7:19 AM
Thread Re: [bf] Anybody Home?????
bf 23353 Mar 21, 2003, 11:45 AM
Thread Re: [bf] Anybody Home?????
604 23412 Mar 21, 2003, 4:32 PM
Post Re: [TheStone] Anybody Home?????
bf 23379 Mar 23, 2003, 10:28 AM
Thread Re: [604] Anybody Home?????
Dempsey 22652 Sep 1, 2009, 9:29 PM
Thread Re: [Dempsey] Anybody Home?????
Dempsey 22620 Sep 5, 2009, 2:45 PM
Thread Re: [Dempsey] Anybody Home?????
Dempsey 22617 Sep 6, 2009, 9:45 PM
Thread Re: [Dempsey] Anybody Home?????
604 22566 Sep 11, 2009, 9:37 AM
Post Re: [604] Anybody Home?????
Dempsey 22537 Sep 12, 2009, 1:15 PM
Thread Re: [604] Anybody Home?????
Dempsey 22479 Sep 17, 2009, 9:51 PM
Thread Re: [Dempsey] Anybody Home?????
604 22452 Sep 18, 2009, 8:59 AM
Thread Re: [604] Anybody Home?????
Dempsey 22440 Sep 19, 2009, 10:31 AM
Post Re: [Dempsey] Anybody Home?????
Dempsey 22323 Sep 23, 2009, 9:51 PM
Thread Re: [604] Anybody Home?????
Dempsey 22631 Sep 9, 2009, 8:57 PM
Post Re: [Dempsey] Anybody Home?????
Dempsey 22575 Sep 11, 2009, 12:05 AM