Gossamer Forum
Quote Reply
Adding Commas To Counts
I want add commas to count for <%TotalCats%>
but this globat :
sub {
my $tags = shift;
local $_ = $tags->{TotalCats};
return 0 unless defined $_;
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}
It's wrong.
Someone can Help me ???


Thanks in Advance
Bye From Italy
Quote Reply
Re: [fabio] Adding Commas To Counts In reply to
The global isn't wrong, it works well....perhaps you could state what is wrong?
Quote Reply
Re: [Paul] Adding Commas To Counts In reply to
I want add on Home page Total Cats formatted,
but this tag do not work:
sub {
my $tags = shift;
local $_ = $tags->{TotalCats};
return 0 unless defined $_;
1 while s/^([-+]?\d+)(\d{3})/$1.$2/;
return $_;
}

This is the output: 26.801 Sites, CODE(0x854adb8) Categories, 200 Editors

why ???
Help Me!!!!


Thanks in Advance
Bye From Italy
Quote Reply
Re: [fabio] Adding Commas To Counts In reply to
>>
$tags->{TotalCats};
<<

Where is $tags->{TotalCats} coming from?
Quote Reply
Re: [Paul] Adding Commas To Counts In reply to
Here is how I put comma's in a category count:



Quote:


sub {
my $cat_db = $DB->table('Category');
my $cat_num = $cat_db->count;
$cat_num =~ s/^([-+]?\d+)(\d{3})/$1,$2/;
return $cat_num;
}


Should work for you, too!
dave

Big Cartoon DataBase
Big Comic Book DataBase