Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Link counts on Home Page

Quote Reply
Link counts on Home Page
Links create its HTML pages in a subdirectory called directory. htttp://www.mysite/directory
I want my total link count to appear on my main root page, htttp://www.mysite/

I created a template called total.html with the globals tags that you want and then calling it

<?php virtual("/cgi-bin/links/page.cgi?p=total"); ?>

However I get a 0 for the total numbers of links
There are 0 active vendors listings in the database.What am i missing???
Quote Reply
Re: [Sies] Link counts on Home Page In reply to
Hi,

When running the page:

/cgi-bin/links/page.cgi?p=total

...does it show the right link count?

I would try something like this if not:

Code:
sub {
return $DB->table('Links')->count( { isValidated => 'Yes' } ) || 0;
}

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Link counts on Home Page In reply to
Hope that helps.

It should, if I could figure where to put it. ???

Code:
sub {
return $DB->table('Links')->count( { isValidated => 'Yes' } ) || 0;[/code]
Quote Reply
Re: [Sies] Link counts on Home Page In reply to
Where do I put this
sub {
return $DB->table('Links')->count( { isValidated => 'Yes' } ) || 0;[/code]
In the head or body of with document total.html or index.php
Quote Reply
Re: [Sies] Link counts on Home Page In reply to
Hi Sies,

This should be a global.

In admin panel, click on the 'Build' link on top then 'Template global' link on the left, scroll down and enter 'link_count' on the "New: " box and put the code into the box on the right. After click on the "Save chages" button, just put this code <%link_count%> in your home.html template or anywhere , the number should be printed out.

Hope that helps!

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] Link counts on Home Page In reply to
Thanks, it works great but.....
How can I format the total. the number would look better with commas ,
123,456
Quote Reply
Re: [Sies] Link counts on Home Page In reply to
Hi,

Please just try this

sub {
my $c= $DB->table('Links')->count( { isValidated => 'Yes' } ) || 0;
my $sep ='.';
1 while $c=~ s/(\d)(\d{3})($|$sep)/$1$sep$2/g;
return $c;

}

Cheers,

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] Link counts on Home Page In reply to
Now I get this with the last code
There are 1.5.595 active vendors listings in the database.The first code gives me this
There are 155995 active vendors listings in the database.I lost a digit "9" with the latest code also.
Quote Reply
Re: [Sies] Link counts on Home Page In reply to
Hi,

This will do it:

Code:
sub {
my $c= $DB->table('Links')->count( { isValidated => 'Yes' } ) || 0;
my $sep ='.';
1 while $c =~ s/^([-+]?\d+)(\d{3})/$1$sep$2/;
return $c;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Link counts on Home Page In reply to
Hi
Perfect, thanks.
I replaced the dot '.' for a comma ','