Gossamer Forum
Home : Products : Links 2.0 : Customization :

Top 10 on home page by number of visits

(Page 3 of 5)
> > > >
Quote Reply
Re: Top 10 on home page by number of visits In reply to
You need to use one of the following codes:

Code:
$topsites_output .= qq|$count. <font face="Arial" size="2"><a href="$url{$field}">$name{$field}</a> ( $hits{$field} passages)</font><br>\n|;

-OR-

Code:
$topsites_output .= "$count. <font face=\"Arial\" size=\"2\"><a href=\"$url{$field}\">$name{$field}</a> ( $hits{$field} passages)</font><br>\n";

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Top 10 on home page by number of visits In reply to
I have looked and looked for Directions on how to place the top 10 sites on my home page,
But I can't seem to find an simple set of instructions.

Is there a URL or a place where I can get this, I would like to set up a Top 10 sites on my main page.
I have check the resouces, but the file is incomplete, starts at insturction 4.

Any help would be appreciated.
Thanks John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
Look on Page 2 of this Thread...I have posted codes about three times for doing this via SSI and also through the nph-build.cgi build process. Look again!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Thank you, i missed that.

I have installed but I am getting this error.

[an error occurred while processing this directive]

I am using this Call in stead of !--#exec cgi=" My understand it it works the same.

!--#include virtual="/cgi-bin/admin/topten.cgi"--


Here is the code for the topten.cgi

#!/usr/local/bin/perl
# Script for putting Top Ten Sites in other LINKS associated pages.
# Change the permission of this script to 755.
# Change the path to the links.cfg file if you need to.
# Use it in the following manner:
# in SSI capable
# pages.
###########################################################
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.

require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
#========================================================
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[8];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a>
\n";
}
$count++;
}
return $output;
}



I set permissions to 755, and I still get the error.

Any Idea's

Thanks.
John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
The script NEEDS to be outside a password protected directory. I am assuming that your admin directory is password protected.

Put the cgi script in your cgi-bin directory and then change the SSI call you have to the following:

Code:

!--#include virtual="/cgi-bin/topten.cgi"--


If this SSI call doesn't work after moving the topten.cgi script, then try the following SSI call:

Code:

!--#exec cgi="/cgi-bin/topten.cgi"--


Remember that you have to add < at the front and > at the end of these SSI calls.

If neither of these SSI call codes work, then your server probably has something misconfigured that does not allow SSI calls.

BTW: You also need to change the following codes:

Code:

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.


to the following:

Code:

require "/absolute/path/to/cgi-bin/admin/links.cfg"; # Change this to full path to links.cfg if you have problems.


Change /absolute/path/to/ to your COMPLETE (full) path in your server.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I tried all that and it still does not work.

All my other SSI works fine.

I use itfor WebAdvers.
And some Text Calls.

And it worlks fine.

Any other Ideas.....

John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
Yea...copy your topsites.cgi script as a text file and upload it to your web server in a publicly accessible directory. Do the same for your current version of the web page you are using the SSI call in.

Then post the URL to these text files.

I betcha you are not using the complete codes and that you are not using the correct SSI call! Wink

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Thanks,

Here is where I put the files.

http://www.incomemax.com/links/

Quote Reply
Re: Top 10 on home page by number of visits In reply to
Uh...I got an error message when I tried to look at your topten.cgi file...SAVE it as topten.txt!!!!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Done. I has been changed.


John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
Welp...I looked over your file and there does not seem to be any syntax errors...

I would double check the following:

1) Perl path (first line of the file).
2) Permission of the file (755).

Other than that...I don't know what to tell ya.

Best of luck!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I've installed your code on calling the top 10 site list onto a seperate (other than links) page via ssi code but I'm getting an error that I can't figure out for the life of me.

Unmatched right bracket at ...cgi-bin\links\topsites.cgi line 46, at end of line syntax error at ...cgi-bin\links\topsites.cgi line 46, near "}" Execution of ...cgi-bin\links\topsites.cgi aborted due to compilation errors.

Here's my code:

#!/usr/local/bin/perl
# Script for putting Top Ten Sites in other LINKS associated pages.
# Change the permission of this script to 755.
# Change the path to the links.cfg file if you need to.
# Use it in the following manner:
# in SSI capable
# pages.
###########################################################
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
#========================================================
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[8];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a>
\n";
}
$count++;
}
return $output;
}

I can't find any difference between the above and what you wrote. Can someone please take a quick look and let me know if you see anything missing. If not, I'm giving up on this mod.

Thanks


Quote Reply
Re: Top 10 on home page by number of visits In reply to
You need to delete the last right bracket } after return $output;.

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I still get this error:

Can't return outside a subroutine at D:\216.247.220.101\cgi-bin\links\topsites.cgi line 45.

I've tried everything and it's still not working. urgh!


Quote Reply
Re: Top 10 on home page by number of visits In reply to
Well...here are some other suggestions...

1) Since you are on a Windows server, have you tried the similar SSI calls you are using for your other SSI programs.

2) The other problem could be your database delimiter. What is your database delimiter (as defined in the $db_delim variable in the links.def file)???

If it is not |, then you need to change the following codes:

Code:

@data=split (/\|/);


to the following codes:

Code:

@data=split (/$db_delim/);


Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Thanks for all your help.

Still could not get it working,

Here is one thing you could look at.
It is the FAQ on SSI for my server.

http://www.hypermart.net/templater.gsp?id=/development/serverscript/ssifaq

Not sure it this help.

If not I will try talking to the Support people at the compay.

Thanks Again

John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
sorry Just thought of something
You may not be able to access it.

Here is the infomation.
__***************


This tutorial is for the beginner and does not contain detailed information for troubleshooting any SSI problems or scripting errors. If you are having troubles implementing SSI into your HTML documents, please submit your question to our CGI newsgroup. This is an excellent resource for finding similar problems and getting the help you need efficiently and quickly.

Server-side includes at HyperMart is parsed from any HTML document. There is no need to designate with the extension ".shtml", as our servers are scripted to process every document to have an SSI in it or not. You can get more documentation as to what other SSI attributes you can use from NCSA under "SSI Format" (NOTE: all attributes 'must' be in lower-case.) The simplest example of server-parsed HTML is to have a file "foo.html" containing this text:

Line one< P >
!--#exec cmd="/cgi-bin/mycgi.cgi" --
Line three< P >

And then have a file mycgi.cgi that contains, on Unix:

#!/bin/sh
echo "Line two"

Or, on Windows NT, use mycgi.bat as the filename (and make sure you use this filename in your foo.shtml file instead):

@echo off
echo Line two

And when you access foo.html, it will output:

Line one
Line two
Line three

If your include directive is !--#exec cmd="..."--, then the output of the command you specify will be spliced directly into the page output. If your include directive is !--#exec cgi="..." --, then the cgi program you run must output a standard CGI header (Content-type: and whatever other header lines you want, followed by a blank line, then the

Do not put any spaces before the # character in your include directives; if you have <!-- #exec instead of <!--#exec, the line will be ignored.

Server-side includes in "custom trailers" will not work, since custom trailers are appended to the output of your Web pages after all other processing has been done on them. Any server-side includes that you put into your custom trailers will be sent directly to the browser without being parsed.

Our system cannot parse SSI inside of SSI. So if you are trying that, it will not work.

Thanks again..


John

Quote Reply
Re: Top 10 on home page by number of visits In reply to
In Reply To:
Not sure it this help.
Who is trying to help whom???

I am trying to help you...it is not my responsibility to troubleshoot your scripts for you....just to provide helpful suggestions, which I have already done. Wink

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Thanks for the mumble jumble stuff...I really don't know what to tell you...the codes I've provided are strictly SSI and are not executed within SSI.

And it seems that you are not using the correct SSI call in your SSI enabled web page...

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I am using ssi to insert my ads on the same page that I can't get this mod to work. Also, my delimiter is | as defined in links.def.

I'm clueless and unless you can think of anything else, I'm dropping this one since I've already waisted too much time on it.

Thanks for your help.


Quote Reply
Re: Top 10 on home page by number of visits In reply to
The only other suggestion I have is to use the regular TOP TEN Mod....What you could possible do is create a separate .html file from the original codes provided for the Top Ten on home page, then use the SSI to include the .html file...a bit more involved, but it may work.

In Reply To:
I'm clueless and unless you can think of anything else, I'm dropping this one since I've already waisted too much time on it.
Is this is a threat??? Because you have stated this twice now...What do you want me to do???? I have tried to help you and it seems that you are unappreciative of my attempts to assist you...All I can say is best of luck with Links and your future endevours. And if these statements are intended to be a threat...then they are not the most effective method in getting assistance from other Links users.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I'm sorry my reply seemed a little insulting. I certainly didn't mean anything by it and my sarcasm didn't come across very well. I SINCERELY appreciate all of your, and everyone else in this forum's, help since I would be worthless without it. My frustration of not getting the mod to work made my reply sound like I was complaining about your help which I certainly am not. Sorry again and I'll try to cut out the sarcasm and frustration so I don't give the wrong impression.

I appreciate your help.


Quote Reply
Re: Top 10 on home page by number of visits In reply to
You're welcome...and no offense taken...I was just confused about your intentions in the statement I highlighted before.

Smile

Regards,

Eliot Lee
Quote Reply
I am getting the same error In reply to
I have getting the same error.

Not sure what the problem is.


John

Quote Reply
Work with site_html.pl In reply to
Will this same code work with site_html.pl.

Or are there some changes needed.

All references talk about the site_html_templates.pl.

If anyone knows, it would be appreciated.

Thank you
John

> > > >