Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

top 5 links global

(Page 1 of 2)
> >
Quote Reply
top 5 links global
This top5 global by hits currently displays this:

Alexandra Silk: 3
Amber Micheals: 1
Adult DVD Explorer: 0
Dancernet: 0
DFW Nites: 0



How do I get them to be hyperlinked?



sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Hits DESC', 'LIMIT 5');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top5_loop => \@output };
}

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
In the while loop before $link is pushed into the array you'd need to add something like:

$link->{some_new_field} = qq|the hyperlink|;

Then you can put <%some_new_field%> in your loop in the template.

Last edited by:

Paul: May 6, 2002, 12:38 PM
Quote Reply
Re: [Paul] top 5 links global In reply to
How is possible to list the category of each listed last link?
(I mean to get the correct category ID or Name, for the current link ID. Only this task may be problem for me.)

This should be an easy task, however I was not able to find out, yet.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
Hi adultdvdlinks

You could try this <%top10%>

sub {
#Top 10 sites by hits.
my ($output,$sth,$link);
my $id = shift;
my $db = $DB->table ('Links');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $db->select ( { isValidated => 'Yes'} );
my $premium;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}

Call it via

<%top10%>
<%loop top10_loop%>
<%endloop%>

and make up the link1.html template, it would look something like this:

<a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>">
<%Title%>: with <%Hits%> hits.</a>

Regards

minesite
Quote Reply
Re: [minesite] top 5 links global In reply to
This worked great minesite.



thanks a bunch

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
You can see an example at my website lower right corner.

WinkCaution it's adult materialWink



http://www.adultdetective.com/...n/links/page.cgi?d=1



Michael

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
Looks good, are you still planning on having latest/top reviews on your front page?
Quote Reply
Re: [sooke] top 5 links global In reply to
I hope so, hopefully somebody can help us out with that one.



Michael

Michael Carpenter

Adult DVD Links
Adult Detective
Post deleted by webmaster33 In reply to
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
This is the global that I'm using to show the newest reviews on the home page:

sub {
# Displays the newest links on the home page.
my ($output, $sth, $review);
my $search_db = $DB->table('Reviews');
$search_db->select_options ('ORDER BY Review_Date DESC');
$sth = $search_db->query_sth ( { Review_Validated => 'Yes' });
my $i=1;
review: while ($review = $sth->fetchrow_hashref) {
my $desc = $review->{Review_Contents};
unless (length $desc <= 30) {my $short = substr ($desc, 0, 30); $short =~ s/\s\S+?$//; $short .= " ..."; $review->{Review_Contents} = $short;}
$output .= Links::SiteHTML::display ('review_new', $review);
last review if ($i>=3);
$i++;
}
return $output;
}


It uses a different template review_new.html which you need to add. You can change the $i>=3 to any number you want. You can see it at theukhighstreet.com.

Hope that helps someone.

Laura.
Quote Reply
Re: [afinlr] top 5 links global In reply to
Hi Laura, nice Global!

I have a question. Did you have to modify any of the .pm files to create your review_new.html template? I am interested in doing the same thing, but not sure how to create additional templates which are included in the build. I am assuming you are running static pages. Or do I just make a page called review_new.html, the global will include and build it (sorry I am at dummy level here). I am going to add this to my new.html for now, make a new heading under New Links called New Reviews.Smile

I have posted a suggestion for including all of these "newest" type of things under the "Whats New" menu item in the same fashion as the newest links. See: http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=194939

Thanks

Last edited by:

sooke: May 8, 2002, 10:05 AM
Quote Reply
Re: [sooke] top 5 links global In reply to
Hi Ian,

No, I try not to modify .pm files at all if possible as it creates a lot of problems with upgrades.

To add a new template you just need to go to your template editor and load one of your existing templates which is similar to the one you want to create and then at the bottom put in the new file name (e.g. 'new_template_name.html') and click 'save as'. You can then start using the new template within other templates with <%include new_template_name.html%>. In this case, the template is called from within the global.

The template that I have created for new reviews is:

<center>
<%body_font%><b><a href="<%db_cgi_url%>/review.cgi?ID=<%Review_LinkID%>"><%Review_Subject%></a></b></font>
<br><img src="<%build_images_url%>/default/stars-<%Review_Rating%>.gif">
<br>
</center>
<%body_font%>
<%if Review_GuestName%>
by <b><a href='mailto:<%Review_GuestEmail%>'><%Review_GuestName%></a></b><br>
<%else%>
by <b><a href='<%db_cgi_url%>/review.cgi?user=<%Review_Owner%>'><%Review_Owner%></a></b><br>
<%endif%>
<%Review_Contents%>
</font>
<br><hr width="65%" color=<%color11%>>

Once you have added this and the global, you can call the new reviews with the name of your global - so if you call the global 'new_reviews', just add the tag <%new_reviews%> on your homepage.

Laura.
Quote Reply
Re: [afinlr] top 5 links global In reply to
Perfect! Thanks Laura, I am going to try that now.

Smile


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [afinlr] top 5 links global In reply to
Awesome Global, thanks again for sharing it Laura!

Smile

Last edited by:

sooke: May 8, 2002, 11:04 AM
Quote Reply
Re: [afinlr] top 5 links global In reply to
No ID tag found! This tag can only be used on link.html or detailed.html templates.



This is the error I get on your site when I click on the by:

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
I have it working on my site. Perhaps the ID is pointing at a link/review which has been deleted? Or maybe not. Maybe it has something to do with your build settings?

Last edited by:

sooke: May 8, 2002, 11:08 AM
Quote Reply
Re: [sooke] top 5 links global In reply to
I get this error if I click on the reviewers name.



Unknown Tag: 'review_count' review(s)

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
It was an error in the review template!



global works great!

Michael Carpenter

Adult DVD Links
Adult Detective
Quote Reply
Re: [adultdvdlinks] top 5 links global In reply to
This is a problem with the review script which I have been trying to get sorted.

See http://www.gossamer-threads.com/...orum.cgi?post=194154

The only way that I have been able to get the correct reviews to show up is to add the <%Links::Utils::load_reviews%> tag to the top of of my review_search_results template - and this is what is giving the error on the user reviews page. I think that a proper fix would involve editing the review.pm file which I don't want to do unless someone from GT agrees that it really is a bug. I have found one other site with reviews on it which does have the same problem.

Laura.
Quote Reply
Re: [afinlr] top 5 links global In reply to
Has anyone tried converting this template for those of using page.php?

Nice template, but, err, hard to change back...
Quote Reply
Re: [dmoynihan] top 5 links global In reply to
its possible to build numered list

like

1.title

2.title

n.title

please help to modify this mod.
Quote Reply
Re: [romanslon] top 5 links global In reply to
Depends which global you are using. If you are using a loop, I assume this should work:

<ol>
<%loop loopname%>

<li><%link%>
<%endloop%>

</ol>
Quote Reply
Re: [minesite] top 5 links global In reply to
Hello!

This question is for minesite or anyone else who wight be able to answer it....
How would I change the following global to display the top 10 in the specific category that the global is placed on and the categories below it, So as a person drums down though the directory the top 10 will become more specific to the individual category?

In Reply To:

sub {
#Top 10 sites by hits.
my ($output,$sth,$link);
my $id = shift;
my $db = $DB->table ('Links');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $db->select ( { isValidated => 'Yes'} );
my $premium;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}
Thanks, George
Quote Reply
Re: [macbethgr] top 5 links global In reply to
From the forum:

sub {
# Displays the 10 most popular links per category.
my ($output,$sth,$link);
my $id = shift;
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, { isValidated => 'Yes'} );
my $premium;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('
link2', $link);
}
return $output;
}

Called via:
<%popular_cat ($ID)%>



Regards

minesite
Quote Reply
Re: [minesite] top 5 links global In reply to
Thanks for your reply.

I tried what you suggested, but it will only display links in that particular category, not the categories below it.... Any suggestions on how to achieve this?

George
> >