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

show category name by random link globle

Quote Reply
show category name by random link globle
It is possible to show category name for radom link's category name?

I have searched forum and could not find disscussed topic related to this issue.



any help will be appreciated.

Thanks
Quote Reply
Re: [courierb] show category name by random link globle In reply to
You could probably use a "hook" to pull the CategoryID in the CatLinks table. Although this would be a bit tricky to find the primary category, if you put links in multiple categories.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [courierb] show category name by random link globle In reply to
Can you explain a little more, I'm not sure what you mean?

Are you wanting to select a random category?
Quote Reply
Re: [Paul] show category name by random link globle In reply to
Thanks stealth.



actually i want put one selected or random "category name with a link to that category page" on home page.

you could call it "recommended category" or "random category"



by the way how to use where condition in "select_options" ?
Quote Reply
Re: [Paul] show category name by random link globle In reply to
weather "top_cats" globe is a good start for it?
Quote Reply
Re: [courierb] show category name by random link globle In reply to
Could you explain what you want to do and Im sure someone can help. Are you wanting to select a random link and just display the link along with the category it belongs to?
Quote Reply
Re: [Paul] show category name by random link globle In reply to
Thanks Paul

yes, i want to display random link along with the category it belongs to at homepage.

only display one category name and one link only.

Or simply display random category name on homepage with a link to category page.



Thanks

Austin
Quote Reply
Re: [Paul] show category name by random link globle In reply to
i am back. here is code borrow from random link globe.


Random_category => sub {
my $tags = shift;
my $category_db = $DB->table('category');
my $cat_id = $tags->{Random_CatID};
my $limit = $tags->{Random_Limit} || 1;
my (@output, $sth);
$category_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
if ($cat_id) {
$sth = $category_db->select ( { ID => $cat_id });
}
else {
$sth = $category_db->select;
}while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}return { Random_Loop => \@output }
}


it comes to a bit trouble part. how to show the a links belongs to that category?





Thanks

Last edited by:

courierb: Aug 30, 2002, 6:09 AM