Gossamer Forum
Home : Products : Gossamer Links : Discussions :

total categories

Quote Reply
total categories
who knows a mod that can give me the total categories in my database and show it in home.html???

is there a mod that can set the total subcategories in a category and publish it in subcategory.html???


Quote Reply
Re: total categories In reply to
In your template variables create:


Total_Cats

and define it as:

sub {
my $cat_db = $DB->table(\'Category\');
my $count = $cat_db->count();
return $count
}


Then in any of your templates, you can use <%Total_Cats%> and it will return that value.

Check http://pugdog.com/domains for an example



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: total categories In reply to
thank you it works but i had to change one thing, namely:

sub {
my $cat_db = $DB->table('Category');
my $count = $cat_db->count();
return $count
}

No backslashes in $DB->table('Category');

Quote Reply
Re: total categories In reply to
I cut the routine out of the globals.txt file. When you type it in, you don't need to escape the ' with \. But if you look at the globals.txt file, you'll see that the ' are escaped with \.

It loses something in the translation ;)

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ