Gossamer Forum
Quote Reply
Hits formatted?
I have used the following global to change <%Hits%> on the Top Rated page to display 1,234 instead of 1234.

Code:
sub { # show Hits (with commas - 123,456)
my $tags = shift;
local $_ = $tags->{Hits};
return 0 unless defined $_;
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}


( Tag: changed <%Hits%> to <%Hits_formatted%> )

In links.html the code is slightly different:

Code:
<%~set intHits = $Hits i/ 1%>
Hits: <%intHits%>

Any ideas on how to format this?
Quote Reply
Re: [MJB] Hits formatted? In reply to
Sorted.

Global:
Code:
sub { # show intHits (with commas - 123,456)
my $tags = shift;
local $_ = $tags->{intHits};
return 0 unless defined $_;
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}

( Tag: changed <%intHits%> to <%intHits_formatted%> )

links.html:
Code:
<%~set intHits = $Hits i/ 1%> Hits: <%intHits_formatted%>