Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

how to display URL in this script

Quote Reply
how to display URL in this script
hi, i used Laura's (afinlr) script to show the latest reviews on my site, but the problem is that in my links category, i only save/use the fields URL, ID, and Contact_Email.

what i want to know is how i can replace the ID (the category ID) with the actual category name..

Afinlr's script is this:

Code:
sub {
# Displays the newest links on the home page.
my ($output, $sth, $review);
my $search_db = $DB->table('Reviews');
$search_db->select_options ('ORDER BY Review_Date DESC');
$sth = $search_db->query_sth ( { Review_Validated => 'Yes' });
my $i=1;
review: while ($review = $sth->fetchrow_hashref) {
my $desc = $review->{Review_Contents};
unless (length $desc <= 60) {my $short = substr ($desc, 0, 60); $short =~ s/\s\S+?$//; $short .= " ..."; $review->{Review_Contents} = $short;}
$output .= Links::SiteHTML::display ('review_new', $review);
last review if ($i>=12);
$i++;
}
return $output;
}

i don't know how to return the actual link's category name instead of just the ID number associated with it in the review table.

please help! :) thanks a lot
-simon
http://www.fatscripts.com
Quote Reply
Re: [lastsaga] how to display URL in this script In reply to
I'm not quite clear yet how categories come into this as the global is only looking in the Reviews table. Can you explain a bit more?
Quote Reply
Re: [afinlr] how to display URL in this script In reply to
hi afinlr, thanks for replying so quickly :)

alright, let me try to think how to explain this. basically i used your global, but this is the format that i want the output to be:

Latest Reviews:
- "URL" reviewed by "Reviewer Name"
"Review Body"
- "URL" reviewed by "Reviewer Name"
"Review Body"
- "URL" reviewed by "Reviewer Name"
"Review Body"

something like that. your global returns the link's subject, i think? the problem is i don't use "subject" in my link entries.

sorry, i hope that clears it up a little bit. i'll post again if i'm not being clear enough. and again, thank you so much, i'm not good at perl coding so i'm not really sure how to do this
-simon
http://www.fatscripts.com
Quote Reply
Re: [lastsaga] how to display URL in this script In reply to
Actually, as far as I can see, I think it just returns the Title of the Review rather than the Title of the link.

I think you can do what you want by adding the 'Links' table:
my $search_db = $DB->table('Reviews','Links');

Hopefully that should give you a <%URL%> tag to use in the template.

Last edited by:

afinlr: Nov 8, 2004, 5:21 PM
Quote Reply
Re: [afinlr] how to display URL in this script In reply to
<3 afinlr

thank you :D it worked perfectly ;D
-simon
http://www.fatscripts.com