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

Need Help Writing A Global for Category

Quote Reply
Need Help Writing A Global for Category
I want to be able to display any category name in a category

by simply calling it

heres an example

<%category (439)%>

<%category = '439'%>

439 would be the ID number of the category

I entered these into the category.html and did the build and got error tags for them

Is there another way of calling this ?

I never wrote a global before and if anyone can help out I would greatly appreciate it.

Thanks
Quote Reply
Re: [incik] Need Help Writing A Global for Category In reply to
anyone have ideas on how to start this ?

I was hoping some one might of done this already

Thanks
Quote Reply
Re: [incik] Need Help Writing A Global for Category In reply to
What information of a category do you precisely want, only the category name, or all the information for this category?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Need Help Writing A Global for Category In reply to
Hi Yogi... i just messaged Incik, but if youare going to write this... i'll leave you to itWink


Edit: probably something like:


sub {

my $cat_id = shift;
my $ct = $DB->table('Category');
my $output;
$output = $ct->select ( ('Full_Name'),{ID => $cat_id } )->fetchrow_array;
return $output;
}

Edit2: <%category_name ('431') %>


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 5, 2002, 10:30 PM
Quote Reply
Re: [Ian] Need Help Writing A Global for Category In reply to
Thanks !!

It worked perfectly

just wondering if I can make modification to it so it looks a little different.

How can I have it appear with number of links in its category next to it

Example: Cars (58)

Another mod is to have the name also linked to that category

Example: <a href=http://www.mysite.com/cars>Cars</a> (58)



Thanks for all your help
Quote Reply
Re: [incik] Need Help Writing A Global for Category In reply to
Code:
sub {
my ($name, $num) = $DB->table('Category', 'Links')->select ( { 'Category.ID' => $_[0] }, ['Full_Name', 'Number_of_Links'] )->fetchrow;
return "$name ($num)";
}

Last edited by:

Paul: Jun 6, 2002, 3:24 AM
Quote Reply
Re: [Paul] Need Help Writing A Global for Category In reply to
Thanks Again !!

Is there a way to just display the Title of the category instead of the full path ?

I tried it and this is what I got for a different category

Cars/V/Volkswagon (3)

Would it be possible to display:

Volkswagon (3)



Thanks for all your help
Quote Reply
Re: [incik] Need Help Writing A Global for Category In reply to
Change Full_Name to Name