Gossamer Forum
Home : Products : Links 2.0 : Customization :

Total Links in Admin Area

Quote Reply
Total Links in Admin Area
How do you add the grand total of links in the database to the left frame of the admin area?

Quote Reply
Re: Total Links in Admin Area In reply to
Read the following FAQ, which is linked in the Resource Center (You will have to tweak the codes a bit to work in the admin_html.pl file.)

http://www.anthrotech.com/cgi/links/faqs/numbers/

Have you even been to the Resource Center? Doesn't seem like it. Tongue

Regards,

Eliot Lee
Quote Reply
Re: Total Links in Admin Area In reply to
I have looked there, I have been trying for a few hours to get that 'sub numlinks' thing to work in admin_html.pl, and I can't seem to get it to work, tried [uttin it in db_utils.pl and that and still no luck.

That's why I am posting here, hoping that someone can give me some advice on how I can do it.

Quote Reply
Re: Total Links in Admin Area In reply to
Okay...well the next thing you should've done is search the forum (because I have posted the codes for the admin_html.pl about three times in the past two months)! Mad

Okay...for the third time....

1) Add the following in your admin_html.pl file:

Code:

sub numlinks {
#------------------------------------------------------------------
# Displays number of links

my $count = 0;
open (DB, "<$db_links_name") or
&cgierr("error in numlinks. unable to open database:$db_links_name.\nReason:
$!");
LINE: while (<DB> ) {
if (!(/^#/) && !(/^\s*$/)) {
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
++$count;
}
}
close DB;
return $count;
}


2) Then add the following codes in any of the pages in the admin_html.pl where you want the total number of links to appear:

Code:

|;
print &numlinks;
print qq|


Got it?

Eliot Lee
Quote Reply
Re: Total Links in Admin Area In reply to
Thanks, it works now!

I tried something similar to that, the only thing I forgot to put in was the 'print' statment, I left that out. That's why it wouldn't show anything :-). Thanks again.

Quote Reply
Re: Total Links in Admin Area In reply to
You're welcome. Glad you finally got it! Tongue

Regards,

Eliot Lee