Gossamer Forum
Home : Products : Gossamer Links : Discussions :

number of total categories

Quote Reply
number of total categories
Hello im just installing and costumizing my brand new Links SQL...phew......and im wondering if there is any way to show how many categories are online?

Thanks, chris

Quote Reply
Re: number of total categories In reply to
Hi,

just make a new template global (Admin -> Build -> Template Globals) and call it "TotalCats":
Code:
sub {
# show total number of categories
my $cat_db = $DB->table ('Category');
my $count = $cat_db->total;
return $count;
}
With that you can use the tag <%TotalCats%> in your templates (i.e. category.html or footer.txt).


Andreas
http://www.archaeologie-online.de
Quote Reply
Re: number of total categories In reply to
hello digger,

thanks alot, its working! you helped me out really...
btw...does anyone know why sometimes you get the message

"Actually Unknown Tag: 'grand_total' handpicked Resources
classyfied in 143 Categories online"

this message i get on the category page...at the same time
with the same coding works the indexpage fine....???

Thanks, Chris

Quote Reply
Re: number of total categories In reply to
Hi,

to display the number of links on each category page you need another global (call it "NumOfLinks" for example):
Code:
sub {
# show total number of validated Links in database
return $DB->table ('Links')->count({isValidated => 'Yes'});
}
and then use the tag <%NumOfLinks%> in the category.html template.


Andreas
http://www.archaeologie-online.de
Quote Reply
Re: number of total categories In reply to
Hello and thanks again for your prompt and sucessfull help!

Chris

Quote Reply
Re: number of total categories In reply to
Hello Digger,

I was wondering if you could help me out once more....(i was so surprised how fast you could it before)...
the same as before, cut i cant figure it out...got terrible errors.....

i want to count total editors and total users

It would be great if you could help me once more....
Thanks Chris

Quote Reply
Re: number of total categories In reply to
Same process, but call different tables...look at the codes you've installed and you should what you need to do.

Regards,

Eliot Lee
Quote Reply
Re: number of total categories In reply to
Hello,

thanks to all, i figured it out.
For those who could use it too:

total users:

sub {
# show total number of validated Users in database
return $DB->table ('Users')->count({Status => 'Registered'});
}


total editors:

sub {
# show total number of editors
my $edit_db = $DB->table ('Editors');
my $count = $edit_db->total;
return $count;
}

for the call in the template use the same procedure as described above.


Thanks and good luck,

Chris