Gossamer Forum
Quote Reply
Counting different Links
Hi,

I have a Download Site based on Links SQL Dbase with many Links.
Each Link has a field with the information if the Download is Freeware, Shareware, Demo etc.
I will now show how many Links of each Freeware, each Shareware etc. are in the Dbase.

Anyone knows a global for this ??

Thanks,
qix
Quote Reply
Re: [qix] Counting different Links In reply to
Hi,

Should be pretty simple. Whats you "type" field? (the one that holds the "freeware", "shareware" etc in?)

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: [qix] Counting different Links In reply to
Hi,

Here you go:

Make a new global - called "count_links_with_type"

Code:
sub {
my $field = 'Type';
return $DB->table('Links')->count( { $field => $_[0] } ) || 0;
}

Be sure to edit the bit in red to the field name that holds the download type =)

Then, call with:

Code:
Freeware: <%count_links_with_type('Freeware')%>
Shareware: <%count_links_with_type('Shareware')%>
..etc

Hope that helps.

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!

Last edited by:

Andy: Apr 8, 2008, 4:39 AM
Quote Reply
Re: [Andy] Counting different Links In reply to
Thanks Andy,

that works pretty good Smile

Cheers,
Frank