Gossamer Forum
Home : Products : Gossamer Links : Discussions :

LinkAuthor list..

Quote Reply
LinkAuthor list..
Hi

We are adding an article section to the site..

Each article has a LinkAuthor, which is defined in the links table.

What will be the best way to return a list of all the LinkAuthors we have in the database, so we can offer the users a "browse by author" option?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] LinkAuthor list.. In reply to
Hi,

i do this with a search link and search for the linkowner on the detail page.

search.cgi?mh=10&LinkOwner=<%linkowner%>

It works not 100% because if you search for a linkowner

goofy and you have a linkowner goof , you recieve the links

from both owner.

Best regards from
Bremen/Germany

Lothar
Quote Reply
Re: [eljot] LinkAuthor list.. In reply to
I think you need to set ww=1 for an exact match.
Quote Reply
Re: [afinlr] LinkAuthor list.. In reply to
Hi

I do not think I was clear on this issue..

I am looking for a global to return a list of all the LinkAuthors we have in the database without any dublications in a list form with each AuthorLink name linked to the list of books(links) he is an Author for, so users can browse using the author name.
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [afinlr] LinkAuthor list.. In reply to
Thanks Laura,

where do you find this help?

Best regards from
Bremen/Germany

Lothar
Quote Reply
Re: [katabd] LinkAuthor list.. In reply to
Isn't that very similar to showing your user list? Can't you modify that global?
Quote Reply
Re: [eljot] LinkAuthor list.. In reply to
Just from experience Wink. I think that it is documented in the information about query in the module documentation (as far as I can remember).
Quote Reply
Re: [afinlr] LinkAuthor list.. In reply to
Hi

Thnaks :)

The problem is LinkAuthor is a field in the Links Table not like the LinkOwner field...



I tried:

sub {
# Displays authors list of articles with Author.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$sth = $search_db->select ( { LinkAuthor });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}

But it is retuiring all links..
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] LinkAuthor list.. In reply to
Try this

sub {
# Displays authors list of articles with Author.
my ($output,$sth);
my $search_db = $DB->table('Links');
$sth = $search_db->select ( ['DISTINCT(LinkAuthor)']);
while (my $author = $sth->fetchrow_hashref) {
$output .= "<li>$author";
}
return $output;
}
Quote Reply
Re: [afinlr] LinkAuthor list.. In reply to
Thanks Laura

The global is returnig HASH(0x85b17fc)
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] LinkAuthor list.. In reply to
Sorry - change fetchrow_hashref to fetchrow_array
Quote Reply
Re: [katabd] LinkAuthor list.. In reply to
Thanks to Laura, here's the final global:



sub {
# Displays the newest links on the home page.
my ($output,$sth,$user);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY LinkAuthor ASC');
$sth = $search_db->select ('DISTINCT(LinkAuthor)');
while ($user = $sth->fetchrow_hashref) {
$output .= qq~<li>$user->{LinkAuthor}</li>~; }
return $output;
}
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory