Gossamer Forum
Quote Reply
Top 100 2.2.1 > 3.0.4
Hi, I've been using this global here. I'm in the process of upgrading to 3.0.4 and while the global seems to function ok. I got problems with new, updated, and popular all showing up (that I know how to change but am wondering why they do all appear) what I can't figured out is the numbering which I would like to have appear. The ol's and li's do appear where they should be when viewing the source code. Could this be css related?

top_100 =>
Code:

sub {
# Displays the top 100 links in descending order.
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Hits DESC', 'LIMIT 100');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top100_loop => \@output };
}

COOL.HTML (from 2.2.1) This works!

<%top_100%>
<%body_font%>
<ol><%loop top100_loop%>
<li>
<%-- <b><a href="<%URL%>"><%Title%></a></b><br> --%>
<b><%body_font%><a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a></font></b><br>
<%if Description%>
<%body_font%><%Description%></font><br>
<%endif%>
<%if URL%>
<font face="Verdana,Helvetica" size="2" color="#008000"><small><%URL%></small></font><br>
<%endif%>
<small>(Added: <%Add_Date%> Hits: <%Hits%> Rating: <%Rating%> Votes: <%Votes%>)</small>
<%if isValidated eq 'Yes'%>
<small>&nbsp; <a href="<%db_cgi_url%>/rate.cgi?ID=<%ID%>">Rate It</a>
&nbsp; <a href="<%db_cgi_url%>/review.cgi?ID=<%ID%>&add_review=1">Review It</a></small><br><br>
<%endif%>
</li>
<%endloop%></ol>

COOL.HTML DEFAULT (from 3.0.4)

<%loop link_results_loop~%>
<p class="category"><%Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%></p>
<%include link.html%>
<%~endloop%>

COOL.HTML MODIFIED (from 3.0.4)

<%top_100%>
<ol><%-- <%loop link_results_loop~%>--%><%loop top100_loop~%><li>
<%-- <p class="category"><%Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%></p> --%>
<%include link.html%> WORKS! - ALSO TESTED WITH CONTENTS (modified) FROM LINK.HTML
<%-- <b><%Title%>: <%Hits%></b> --%> TESTED
</li><%~endloop%></ol>

Sincerely,

Rob Wesley
Aboriginal Connections (Indigenous Peoples Worldwide)
robwesley@aboriginalconnections.com
Web Directory | Forums

Last edited by:

wesley: Dec 19, 2005, 9:59 PM
Quote Reply
Re: [wesley] Top 100 2.2.1 > 3.0.4 In reply to
Hi,

I believe that is because you need to use $DB->table('Links')->get() , to create things like detailed_url, isNew, isPop etc.

You could try;

Code:
sub {
# Displays the top 100 links in descending order.
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Hits DESC', 'LIMIT 100');
my $sth = $table->select( ['ID'] );
my @output;
while (my $id = $sth->fetchrow) {
my $link = $DB->table('Links')->get( { ID => $id } );
push (@output, $link);
}
return { top100_loop => \@output };
}

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!
Quote Reply
Re: [Andy] Top 100 2.2.1 > 3.0.4 In reply to
Hi Andy, thanks for replying but.....

it didn't work the output is the code itself. :)

Sincerely,

Rob Wesley
Aboriginal Connections (Indigenous Peoples Worldwide)
robwesley@aboriginalconnections.com
Web Directory | Forums
Quote Reply
Re: [wesley] Top 100 2.2.1 > 3.0.4 In reply to
Hi,

It shouldn't do that at all :p

Are you sure you've set it up right? i.e it starts with

Code:
sub {

and ends with;

Code:
}

i.e no spaces at the beginning/end of it.

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: [Andy] Top 100 2.2.1 > 3.0.4 In reply to
Oops, k got the sub right, maybe it was spacing but....

Code:

<%top_100%>
<ol><%loop top100_loop%>
<li><%include link.html%></li>
<%~endloop%></ol>


That's what I'm using but Detailed isn't working and pop, new, updated are all showing as well. I'll keep trying...

Sincerely,

Rob Wesley
Aboriginal Connections (Indigenous Peoples Worldwide)
robwesley@aboriginalconnections.com
Web Directory | Forums
Quote Reply
Re: [wesley] Top 100 2.2.1 > 3.0.4 In reply to
Hi,

Mmm.. odd :/

You could try changing;

Code:
while (my $id = $sth->fetchrow) {
my $link = $DB->table('Links')->get( { ID => $id } );
push (@output, $link);
}

..to;

Code:
while (my $id = $sth->fetchrow) {
my $link = $DB->table('Links')->get( { ID => $id } );
$link->{isPop} ? $link->{isPop} = "Yes" : $link->{isPop} = 'No';
$link->{isNew} ? $link->{isNew} = "Yes" : $link->{isNew} = 'No';
$link->{isChanged} ? $link->{isChanged} = "Yes" : $link->{isChanged} = 'No';
push (@output, $link);
}


I believe the problem you are having, is due to isPop/isNew etc breing set to "1" or "0" ... but in the template, it looks for <%if isNew eq "Yes"%> instead =)

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!