Gossamer Forum
Quote Reply
Count Votes < 10
Hi boysBlush

i am looking for a Global to count the links where Votes > 10 in every Shockedcategory.

Marina
Quote Reply
Re: [mkoenig] Count Votes < 10 In reply to
Something like this maybe?

Code:
sub {

my $ID = $_[0];

my $sth = $DB->table('Links')->select( GT::SQL::Condition->new('Votes','>=','10') );

my $back;
while (my $hit = $sth->fetchrow_hashref) {
$back .= Links::SiteHTML->display('links',$hit);
}

return $back;

}

Call it with;

<%global_Name($ID)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Count Votes < 10 In reply to
Hi Andy

i get an error in sitehtml

i want only the count of the votes > 10

marina
Quote Reply
Re: [mkoenig] Count Votes < 10 In reply to
Oh, in that case, try something like;

Code:
sub {

my $ID = $_[0];
my $count = $DB->table('Links')->count( GT::SQL::Condition->new('Votes','>=','10') );
return $count;

}

Call with <%global_name($ID)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Count Votes < 10 In reply to
Hi Andy

This global works fine

but i want to display the count of links in the category in the category page

ex.

cat 1 -->10

cat2 -->2

cat3 -->20

Marina