Gossamer Forum
Home : Products : Links 2.0 : Customization :

Top 10 on home page by number of visits

(Page 2 of 5)
> > > >
Quote Reply
Re: Top 10 on home page by number of visits In reply to
*sigh*

Try putting the codes I gave you after the following codes:

Code:
$url{$data[0]} = $data[2];

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Top 10 on home page by number of visits In reply to
That was one of my guesses. It doesn't work there. This is the way I have it.
Code:
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];
$name = substr($name,0,8) . "..." if (length($name) > 8);
}
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><br>\n";
}
$count++;
}
return $output;
}

I also tried commenting out

$name{$data[0]} = $data[1];

but is still had the same results. Thanks for the effort Do you have any other ideas? I have it on all my pages, but if I have to I can place it somewhere else on the homepage and take it off the rest of the pages. The way it is now it forces the table wider and distorts the rest of the page.

------------------
Jimmy Crow
www.homewithgod.com
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Well, what you can do as a quick fix is use a nested table for this script, then the text will wrap around rather than expanding the main table column. (This is a quick and dirty solution...plus truncating titles does not always serve end users very well.)

So, put the link codes in the stand alone script codes I gave into a nested table. Do I need to explain how to write nested table HTML codes?

Regards.

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Don't know why I hadn't thought of that.
Thanks for the script and help.

------------------
Jimmy Crow
www.homewithgod.com
Quote Reply
Re: Top 10 on home page by number of visits In reply to
You're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Is it possible to define my top 10 in the link.html template ? Look this:

Instead ...
-----------------------------
<%if isPop%>
<sup><b>Top 5</b></sup>
<%endif%>
-----------------------------

change to ...
-----------------------------
<%if topten%>
<sup><b>Top 10</b></sup>
<%endif%>
-----------------------------

Any ideas ???

Regards,

Marco Aurélio
Quote Reply
Re: Top 10 on home page by number of visits In reply to
That would not be as easy as you have suggested. It would take a lot of work to do this...you would have to do the following:

1) Add another field called isTopTen (refer to the FAQ in the Resource Center on adding links to your links.def and links.db file).

2) Then the sub build_stats routine in the nph-build.cgi file would have to be edited...which I am unsure about how to do at this point.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Ok Eliot ...

I have a sub_topfive and sub_topten in my site_html_templates.pl , but when I call the <%topten%> too is showed the topfive links thus:

1. Una Componentes
2. Cinex Componentes e Acessórios
3. Verdasca
4. Palito
5. zica
1. Una Componentes
2. Cinex Componentes e Acessórios
3. Verdasca
4. Palito
5. zica
6. Muvuca
7. tito
8. Teste - Modify2
9. zeca
10. Muvuca 4 A Demolição!


How can I solve this problem ???

... and is it possible to include 0 in the count ? thus: 01 instead 1 ... ok

Regards,

Marco Aurélio
Quote Reply
Re: Top 10 on home page by number of visits In reply to
I really don't know...How have you set the numbers for the if ($count <= 10) {.

For the Top Five Sub, these codes must be:

Code:
if ($count <= 5) {

AND you have to use separate tags:

<%top_five%>
<%top_ten%>

To change 1 to 01, TRY changing the following codes:

Code:
my $count=1;

to the following:

Code:
my $count=01;

TRY = no gaurantee.

And Marco...please consider buying a Perl book, so that you can learn some Perl, which will allow you to customize your scripts!

Wink

Regards,


------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Hi,
I applied the first top10 code to my site_html_templates and works ok.

I have attempted the second code and the cgi doesn't work
I have edited the path of the links.cfg and it doesn't work.
What can it happen?

[an error occurred while processing this directive]

topsites.cgi 755
transfer in ascii
path of the links.cfg : /home/sites/mysite/web/cgi-bin/links/admin/links.cfg




On the other hand, I would like to make the following thing:

Most visited site:
Yahoo

Without the top10 numeration.
1. Yahoo

Is this possible?

Thanks.




------------------
Quote Reply
Re: Top 10 on home page by number of visits In reply to
For taking out the number...simply delete $count. out of the following codes:

Code:
$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";

For the SSI problem, you may have to use the following codes:

Code:
<!--#include virtual="/cgi-bin/links/topten.cgi"-->

Rename the paths to your top ten script is located. Also change the name of the file.

If this doesn't work...guess what...you do not have SSI enabled.

Smile

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* 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
It show my top 10 sites in this format:
1.name
2.name

I need:
1. name (hits rating)
description

how?
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Man,

You people really need to learn Perl or at least take the time to see what the codes do and may be you can figure it out for yourself!!!!

ANYWAY...this is the last Reply I will add to this Topic...you guys and gals are on your own (get a Perl book or at least familarize yourself with the codes that you copy and paste from these Forums!).

To add the Hits and Ratings and Description, you need to add the following codes in the codes already provided above:

Code:
$descrip{$data[0]} = $data[3];
$hits{$data[0]} = $data[7];
$rating{$data[0]} = $data[8];

Change 3, 7, and 8 to the number of the fields that correspond to your Description, Hits, and Rating field.

Then add the following codes:

Code:
$descrip{'field'}
$hits{'field'}
$rating{'field'}

in the following line of codes:

Code:
$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* 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
Last Question:
Im add your code,but it again not working.
My code:
sub site_html_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.
my (@data,%tophits,%name,%url);
open (NAME,"<$db_file_name");
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];

$descrip{$data[0]} = $data[3];
$hits{$data[0]} = $data[7];
$rating{$data[0]} = $data[9];

$descrip{'field'}
$hits{'field'}
$rating{'field'}

}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$topsites_output .= "$count. <a href=\"$db_cgi_url/jump.cgi?ID=$field\">$name{$field}</a><br>\n";
#$topsites_output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";
#$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";
}
$count++;
}

return &load_template ('home.html', {
topsites_output => $topsites_output,
category => $category,
grand_total => $grand_total,
%globals
});
}
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Roman....

You are using the WRONG codes...

These codes need to be deleted:

Code:
$descrip{'field'}
$hits{'field'}
$rating{'field'}

And for the jump.cgi script you have to work, you need to pull the ID field...which you have not done...you have to add the following codes:

Code:
$id{$data[0]} = $data[0];

AFTER the following codes:

Code:
$rating{$data[0]} = $data[9];

And you need to replace the jump.cgi link that you have with the following:

Code:
<a href=\"$db_cgi_url/jump.cgi?ID=$id{'field'}\">$name{$field}</a>

Except as I mentioned before...why would you want to have jump.cgi for the link in the Top Ten site...if you do, you risk the chance of having a static list of links since people will just keep clicking on the Top Ten sites...

But to each his/her own.

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
Im change coge but and now it have old style:
1.some
2.some

changed code:

sub site_html_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.
my (@data,%tophits,%name,%url);
open (NAME,"<$db_file_name");
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];

$descrip{$data[0]} = $data[3];
$hits{$data[0]} = $data[7];
$rating{$data[0]} = $data[9];
$id{$data[0]} = $data[0];

}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$topsites_output .= "$count. <a href=\"$db_cgi_url/jump.cgi?ID=$id{'field'}\">$name{$field}</a><br>\n";
#$topsites_output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";
#$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";
}
$count++;
}
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Okay...private email did not work...

Roman...again you are using the WRONG codes...

Do the following (and I really hope you get it this time, and a word of advice...get the default codes working before hacking it to fit your needs)....

1) Take out the # signs before the second and third code lines that contains $topsites_output.

2) Put in the following codes (which are the most crucial and included with the default Mod codes):

Code:
return $topsites_output
}

AFTER

Code:
count++;
}

I REALLY hope you get it!

Wink

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.




[This message has been edited by AnthroRules (edited April 16, 2000).]
Quote Reply
Re: Top 10 on home page by number of visits In reply to
oh,sorry,im changed email,but gorget replace it here,now is correct.
I can`t find correct code Frown
Quote Reply
Re: Top 10 on home page by number of visits In reply to
In the last Reply I gave, I provided the codes you need to use!!!

READ IT AGAIN!

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 want to use tables in my top 10 links,but it wount working when I incerrt my code:

# Insert Top Ten Sites
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];
$id{$data[0]} = $data[0];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$descrip{$data[0]} = $data[5];
$hits{$data[0]} = $data[6];
$rating{$data[0]} = $data[9];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$output .= "$count. <TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0 width="100%">

<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">

<TR>
<TD><FONT face="Arial, Verdana" size=2><B><a href=\"$build_jump_url?ID=$id{$field}\">$name{$field}</a></B></FONT>
</TD></TR>
<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=1 width="100%">

<TR>
<TD bgColor=#808080 vAlign=bottom width="100%"><IMG border=0
height=1 hspace=0
src="/images/blackdot.gif"
width=1></TD></TR></TABLE></TD></TR>
<TR>
<TD bgColor=#ffffe8><FONT face="Verdana, Arial" size=2>$descrip{$field}</FONT></TD></TR>
<TR>
<TD><FONT color=#000000 face="Arial, Verdana"
size=1><B>Category:</B></FONT></TD></TR>
<TR>
<TD height=10></TD></TR>
<TR><br>\n";
}
$count++;
}
return $output;
}

error message from links:
Error including libraries: syntax error at /cgi-bin/admin/site_html_templates.pl line 164, near ""$count. " syntax error at /cgi-bin/admin/site_html_templates.pl line 183, near "<" syntax error at /cgi-bin/admin/site_html_templates.pl line 465, near "}" Make sure they exist, permissions are set properly, and paths are set correctly.

What is wrong in my codes?
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Try adding the following operators in your codes:

qq| and |;

So, the table codes should look as follows:

Code:
$output .= qq|$count. <TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0 width="100%">

<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">

<TR>
<TD><FONT face="Arial, Verdana" size=2><B><a href=\"$build_jump_url?ID=$id{$field}\">$name{$field}</a></B></FONT>
</TD></TR>
<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=1 width="100%">

<TR>
<TD bgColor=#808080 vAlign=bottom width="100%"><IMG border=0
height=1 hspace=0
src="/images/blackdot.gif"
width=1></TD></TR></TABLE></TD></TR>
<TR>
<TD bgColor=#ffffe8><FONT face="Verdana, Arial" size=2>$descrip{$field}</FONT></TD></TR>
<TR>
<TD><FONT color=#000000 face="Arial, Verdana"
size=1><B>Category:</B></FONT></TD></TR>
<TR>
<TD height=10></TD></TR>
<TR><br>\n|;

Hope this helps.

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
Hi,
SO I installed the mod, and it's working fine!!! But still, I have a question
... As I show it on http://www.surfootball.ovh.org/example.htm , I'm trying to
change the layout of the thing... could somebody please help,
Smile

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
Quote Reply
Re: Top 10 on home page by number of visits In reply to
Yea...

1) Be more specific of HOW you want to change the layout.

-AND/OR-

2) Read this TOPIC more carefully...because there are codes that allow different layouts.

Wink

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
For the number of visits, I did without too much problem... Now, how can we xhange the background
of each links (as seen at http://surfootball.ovh.org/example.htm) ????
Thanx
Smile)

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
Quote Reply
Re: Top 10 on home page by number of visits In reply to
 Actually, I have another problem.... When I modify this line for the font colors...:

$topsites_output .= "$count. <a href=\"$url{$field}\">$name{$field}</a> ( $hits{$field} passages)<br>\n";
I get a nphbuild error.Here is what I tried:

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

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

and all sorts of combinations, but none of them worked....
Frown

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
> > > >