View Full Version : Latest or Hot Links Module (Updated for version 3 of Links Directory)
larina
11-08-2008, 03:06 PM
Thanks to nostalgia, who provided this hack here: http://www.vbadvanced.com/forum/showthread.php?t=18416
To avoid confusion, I open this new thread with the file that is required to make the hack work with version 3 of Links Directory.
What It Does:
It grabs links from your Links Directory and allows you to display the latest, highest rated, most viewed, random links or most replied links on your CMPS pages.
1. To install, first add these two templates:
adv_portal_latestlinks
$linkbits
adv_portal_linkbits
<tr>
<td class="$getbgrow">
<div><a href="$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a></div>
<div class="smallfont">
$vbphrase[by]
<if condition="$link['userid']"><a href="$vboptions[bburl]/member.php?$session[sessionurl]u=$link[userid]">$link[username]</a>
<else />
$vbphrase[guest]
</if><br />
$link[date] <span class="time">$link[time]</span><br />
<a href="$linkurl/browselinks.php?$session[sessionurl]c=$link[catid]">$link[catname]</a><br />
$link[posts] $vbphrase[replies], $link[views] $vbphrase[views]
</div>
</td>
</tr>
2. latestlinks.php : Then download the latestlinks.php attachement below. Upload the file to your /forum/modules directory.
3. Now add a new module with the following information
Module Title: Latest Links (or whatever you would like to call this module on your CMPS)
File to Include: latestlinks.php
Identifier: latestlinks
Templates Used: adv_portal_latestlinks, adv_portal_linkbits
Use Module Shell Template: Yes
Module Link: {$vbulletin->options}/links/browselinks.php?do=newlinks&cutoffdate
[B]4. According to where you have installed Links Directory, you need to make one last step:
Assuming you are using links directory like that: http://www.domain.com/links/ change the links in the template adv_portal_linkbits like that:
<a href="/links/$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a>
<a href="/links/$linkurl/browselinks.php?$session[sessionurl]c=$link[catid]">$link[catname]</a>
Enjoy :)
----------------------------------------------------------------------
Modifikation for showing thumbs:
If you want to show the link-thumbs inside the module, please use the following code for the template adv_portal_linkbits. Make sure, also to change the link
<a href="$linkurl/showlink.php?$session[sessionurl]do=goto&l=$link[linkid]&linkurl=$link[linkurl]" target="_blank">
to
<a href="$linkurl/links/showlink.php?$session[sessionurl]do=goto&l=$link[linkid]&linkurl=$link[linkurl]" target="_blank">
if you are using Links Directory like that:
http://www.domain.com/links/
adv_portal_linkbits :
<tr>
<td class="$getbgrow">
<div><a href="$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a></div>
<div class="smallfont">
$vbphrase[by]
<if condition="$link['userid']"><a href="$vboptions[bburl]/member.php?$session[sessionurl]u=$link[userid]">$link[username]</a>
<else />
$vbphrase[guest]
</if><br />
$link[date] <span class="time">$link[time]</span><br />
<a href="$linkurl/browselinks.php?$session[sessionurl]c=$link[catid]">$link[catname]</a><br />
<a href="$linkurl/showlink.php?$session[sessionurl]do=goto&l=$link[linkid]&linkurl=$link[linkurl]" target="_blank">
<img src="http://open.thumbshots.org/image.pxf?url=$link[linkurl]" border="0" alt="$link[name]" /></a><br />
$link[posts] $vbphrase[replies], $link[views] $vbphrase[views]
</div>
</td>
</tr>
turbosatan
11-12-2008, 04:26 AM
is there a simple way to make this a "Featured Links" module?
in effect allowing me to pick certain links which will appear on the home page?
larina
11-13-2008, 12:26 AM
Yes, you could use the field for notes, which only moderators can view. So when you submit or edit a link, write "featured" into this private notes field (without the quotes).
To make it work, you need to edit the file latestlinks.php like that:
Search for:
WHERE links.valid = 1 AND links.open = 1 $privcats
And replace this line with:
WHERE links.notes LIKE '%featured%' AND links.valid = 1 AND links.open = 1 $privcats
Now only links are shown, which have the note "featured".
larina
dismas
11-14-2008, 08:20 PM
Very nice!
I had to change the module link though since my links are at http://www.vermontoutdoors.net/links/ and not in /forum/links/
al3ade
11-15-2008, 05:33 PM
WoW !! fantastic work
benFF
11-20-2008, 11:58 AM
Groovy - any chance it could be updated to support SEO friendly URLs? :)
doc1975
11-20-2008, 12:29 PM
Look great! How would I incorporate this with my Ajax Tabs?
larina
11-20-2008, 01:13 PM
Sorry that I don't answer all questions. Whenever I can help, I surely do answer. But I did not code this hack, and I am no programmer, so some questions I simply cannot answer.
If someone will make additions to this hack (for example seo friendly urls, or thumbs) I'll be glad to update post #1 to include those additions.
larina
larina
11-21-2008, 08:07 AM
Thanks to HenrikHansen we now can show thumbs inside the module. You only need to change the template adv_portal_linkbits. Look in post #1 for the Modifikation.
Thanks again, HenrikHansen!! :)
larina
larina
11-22-2008, 12:44 PM
I just saw ... the code for the template adv_portal_linkbits - when using the one to show thumbs - was not xhtml-valid. Sorry. So I edited post #1, now everything is xhtml-valid.
larina
Mondi
11-27-2008, 04:50 AM
Cool!
Larina, three questions - all how-to's:
Putting the thumb on top of each link text?
Little more space between the bottom of the link and the first line of text?
Centering thumbs? - and,
Only three links instead of the five I have.
Right now the module looks somewhat 'cramped' - see here (http://gblcg.com).
Great stuff! Thanks for this...
larina
11-27-2008, 11:44 AM
For only three links instead of five open the file latestlinks.php and change
$limit = 5;
to
$limit = 3;
For your other questions you just need to edit the html-code in the template adv_portal_linkbits to suit your needs.
larina
Mondi
12-19-2008, 06:19 PM
Larina,
I am probably risking being seen as a complete noob here but... how to change the module's vertical layout to horizontal?
Second - I'd like to add text between the module's title - "Recent Links" - and the actual display of the thumbs/links. Perhaps best to give you the code I was given:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.bodybold {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 18px;
font-weight: bold;
}
.bodynormal {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: 18px;
font-weight: normal;
background-position: left;
}
.bodysmall {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: bold;
color: #333333;
}
.bodynormalRed {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: 18px;
font-weight: normal;
background-position: left;
color: #990000;
text-align: right;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="10" cellpadding="2">
<tr>
<td rowspan="2" valign="top"><img src="http://gblcg.com/images/editorial/gblcg_links.gif" width="80" height="80" longdesc="http://gblcg.com/images/editorial/gblcg_links.gif" /></td>
<td valign="top" class="bodynormal"><p align="left"><strong class="bodybold">Links – Fuel Your Knowledge - </strong>Browse an ever expanding catalogue of hand-picked links, each presenting ideas you should know about. Contact thought leaders. Rate their sites and discuss their intellectual worth. Recommend other sites, including yours to increase traffic and exposure. And, while you're at it, you might as well recommend your own site to scoop-up extra traffic. </p> </td>
</tr>
Where to put this piece to have it displayed once only over the links/thumbs?
Will appreciate your wisdom on this!
larina
12-20-2008, 01:24 PM
Mondi, sorry, everything you are asking in your post is just simple html. Don't you have a software like frontpage, to play around a bit?
Text you can add into the template adv_portal_latestlinks before $linkbits. But you should not insert the whole code you posted, instead just the table itself with it's contents.
larina
larina
12-20-2008, 01:36 PM
Hmm, hopefully this didn't sound to bad, sorry again.
But the module gives you all the functions you need to show links/categories/thumbs. How you place them (the styling) is completely up to you. You can change the html-code around those functions how ever you want. Software like Frontpage or Dreamweaver gives nice help for html-newbies to learn the basics without having to study html-books, as you can use the wysiwyg-editor and at the same time you can check the according html-code.
Don Z.
12-23-2008, 11:49 AM
I would like to create a module that displays 5 horizontal random links with thumbnails.
Can you post the code needed in latestlinks.php to do that?
Thanks for your help!
larina
12-23-2008, 06:58 PM
Don, in the file latestlinks.php set $order to 5 and $limit also to 5.
For a horizontal display you need to edit the template adv_portal_linkbits like that:
Find
<td class="$getbgrow">
(it is the second row in the code I posted above)
and replace this row with:
<td class="$getbgrow" rowspan="5" valign="top">
larina
Don Z.
12-24-2008, 01:23 PM
Thanks larina, that worked great!
I created a new horizontal module, php file and template so I can drop either horizontal or vertical displays into a page. That's the ticket!
Thanks again! Ho, Ho, Ho.
turbosatan
01-02-2009, 09:53 AM
can this be made into a module with automated template edits etc?
maikju
01-28-2009, 10:42 AM
Very nice stuff. But i am looking to use links from a certain category instead of random or latest. I am pretty sure it is a simple change...
HenrikHansen
01-28-2009, 11:31 AM
Very nice stuff. But i am looking to use links from a certain category instead of random or latest. I am pretty sure it is a simple change...
In the .php file, find
WHERE links.valid = 1 AND links.open = 1 and
after that add
and links.catid = 17
in case your certain category is number 17.
maikju
01-28-2009, 11:55 AM
Thank you, i am getting closer and closer. The last thing i need is the Rating, how can i get it in there.
If you look at http://cloudhostrating.com/index.php?pageid=ffmpeg_host
at the bottom of the page is the ffmpeg test module . I would like the rating to show with each link
karlm
02-24-2009, 09:21 PM
In the .php file, find
WHERE links.valid = 1 AND links.open = 1 and
after that add
and links.catid = 17 in case your certain category is number 17.
Could you advise on how to add links from several categories? e.g. 17,19,22,23 ?
Thank you.
masterweb
03-15-2009, 10:50 AM
Thanks a lot for your hack, i was looking for an easy way to show "Random Links" from the directory on the home page and i found your hack. Installed and working after 10 minutes on a vB 3.8.1 SP 1. :D
Mondi
03-23-2009, 06:20 AM
Sorry for the delayed response Larina [c 12-21-2008 06:36 AM post]
Could you take a quick peek here (http://gblcg.com), bottom of the page, to see what's gone wrong here. Links display nicely, but header covers only 1/4th of module-top..
Obviously - doesn't look as well as it should...LOL
Hmmm.
Please?
larina
03-23-2009, 03:00 PM
You've got it Mondi? I can't see any problems with the module-top?
larina
ibaker
04-20-2009, 07:40 PM
Don, in the file latestlinks.php set $order to 5 and $limit also to 5.
For a horizontal display you need to edit the template adv_portal_linkbits like that:
Find
<td class="$getbgrow">
(it is the second row in the code I posted above)
and replace this row with:
<td class="$getbgrow" rowspan="5" valign="top">
larina
Just thought I would share this.
I created the horizontal layout with thumbs for 4 links to be displayed but found that the images were dropping down as it progressed through each one. This was caused by the extra <tr>'s in the code.
To fix this I moved the <tr>'s to my adv_portal_latestlinks:
<tr>
$linkbits
</tr>
I then removed the <tr>'s from my adv_portal_linkbits template:
<td class="$getbgrow" valign="top" align="center" width="25%">
<a href="$linkurl/showlink.php?$session[sessionurl]do=goto&l=$link[linkid]&linkurl=$link[linkurl]" target="_blank">
<img src="http://open.thumbshots.org/image.pxf?url=$link[linkurl]" border="0" alt="$link[name]" width="100" height="75" /></a><br /><br />
<div class="smallfont">
<a href="$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a><br />
(<a href="$linkurl/browselinks.php?$session[sessionurl]c=$link[catid]">$link[catname]</a>)<br />
$link[posts] $vbphrase[replies], $link[views] $vbphrase[views]
</div>
</td>
This made the horizontal layout with link images much better.
Hope this helps!
pokash
05-29-2009, 09:13 PM
I think I followed al the instructions correctly but somehow my links don't show a description. Or was this not included to be in the module. If not do I need to add a line in the template?
Everything else works though so props to everyone involved.
pokash
05-30-2009, 12:02 PM
Can someone please give me advice as to what could cause this problem:
http://www.buildrollz.com/index.php
It doesn't show any description with the links.
larina
05-30-2009, 12:39 PM
Hi pokash,
the module does not show a description, so your installation is working fine. You just should use the horizontal view if you use it in the center column (look for the code some posts above). Or move the module to the left or right column, so that it looks better.
larina
Ramses
06-29-2009, 08:01 PM
I would like to know too how to change it for a random link order.
Thanks.
Could you advise on how to add links from several categories? e.g. 17,19,22,23 ?
Thank you.
This works for me:
WHERE links.valid = 1 AND links.open = 1 AND links.catid = 3 OR links.catid = 2 OR links.catid = 174
But I give no guaranty if this will have any bad affect to your installation.
Does this support the last vBA links 3.1.0 with (SEO built in URLS)
larina
07-03-2009, 04:31 PM
Hello zi5,
yes, there should be no problems.
larina
mojtaba79
08-11-2009, 03:22 AM
I would like to know too how to change it for a random link order.
Thanks.
hi
i did every things like a first post and now i have a random links in my homepage.
i do wanna now how to do it for last 5 new links?
thanks for sharing
manny0131
08-15-2009, 05:09 PM
how can I get it to look like this?
http://www.vbadvanced.com/products.php?do=productinfo&productid=2
Looks a lot cleaner, is that also available? I made all the fixes thinking it was gonna look like that and it doesnt
Thanks
manny0131
08-15-2009, 08:32 PM
ok, got it,
just a little editing the template!
see here (http://www.boricuawebs.com)
manny
ice4ys
08-16-2009, 04:05 AM
Hi I have my directory running out of the folder directory instead of links.
I have changed the links marked in red to directory instead of links but it is still not pulling the info through to the module. as shown in the attachment. The thumbnail is showing, although if I click on that it just takes me to the directory.
Are there any other parts of the code I need to change to read as directory instead of links to get this to work.
Work well for vbulletin 3.8.4 and the latest vba cmps!
By the ways, Does anyone know how to make is display links which are devided in two columns
------------
[link1][link2]
[link3][link4]
[link5][link6]
------------
kamikage
09-13-2009, 05:45 AM
Nice Mod!
I centered the text and images and it really looks so much better that way.
kamikage
09-13-2009, 06:44 AM
My Links Block Redesigned
I change the layout of the links block in the: adv_portal_linkbits template.
I think it is nicer to have the thumbnail show at the top and then the link title underneath. It made no sense to me to have the category the link was posted in above the thumbnail. That makes it look like the site is labeled by the category name. I also added in some width and height code to better fit the thumbnail inside the block. Oh and of course I centered everything! (See Attached Screenshot)
kamikage
09-13-2009, 07:56 AM
Here is mine :D
Nice! I would like to make a multi-row center block.
Can you share your instructions for making this into a center block.
THANKS!
I follow this
http://www.vbadvanced.com/forum/showpost.php?p=161609&postcount=17
and change "5"to "3". And uncomented to lines I do not use in the template.
Hi larina and all
Thanx for the mod, and the modi mod for featured.
Can I show some of the featured with random links at the same time?
IE if I have the mod to show 5 links, and I have 2 featured links, I want the 2 featured links to show all the time, and the other 3 to be randomly picked, can this be done?
Thanx in advance
Hani
Trixi.com
10-17-2009, 06:15 AM
Great module. Tx for it. I installed it at www.pedicabforum.com and have to questions:
1. How to configure that latestes entries or random are showed? On my site are random showed, but I would like to show the latest entries.
2. In the sidebar is "Latest Links" - but clicking it goes always to my forum instead to the directory....how to change it?
Thank you and again: Good work
CareyCrew
10-17-2009, 06:55 AM
Great module. Tx for it. I installed it at www.pedicabforum.com and have to questions:
1. How to configure that latestes entries or random are showed? On my site are random showed, but I would like to show the latest entries.
2. In the sidebar is "Latest Links" - but clicking it goes always to my forum instead to the directory....how to change it?
Thank you and again: Good work
1)You edit the setting in the module file.
<?php
// ++=========================================================================++
// The order you would like to pull the links in.
//Enter 1 for newest, 2 for most viewed, 3 for most comments, 4 for highest rated, 5 for random
$order = 5;
// Enter the number of links you would like to display here
$limit = 5;
// Maximum characters of the links name before the rest will be replaced with '...'
// Set this to 0 to disable it.
$maxnamechars = 0;
// No further editing necessary
switch($order)
2). According to where you have installed Links Directory, you need to make one last step:
Assuming you are using links directory like that: http://www.domain.com/links/ change the links in the template adv_portal_linkbits like that:
<a href="/links/$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a>
<a href="/links/$linkurl/browselinks.php?$session[sessionurl]c=$link[catid]">$link[catname]</a>
Trixi.com
10-17-2009, 09:27 AM
Thank you very much. Now I changed from random to newest. Thanx a lot.
Regarding the second question / answer: This is what I have in my template:
<tr>
<td class="$getbgrow">
<div><a href="/links/$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]">$link[name]</a></div>
<div class="smallfont">
<br />
<a href="/links/$linkurl/showlink.php?$session[sessionurl]do=showdetails&l=$link[linkid]" target="_blank">
<img src="http://open.thumbshots.org/image.pxf?url=$link[linkurl]" border="0" alt="$link[name]" /></a><br /
</div>
</td>
</tr>
So the links itself and the thumbnail they are forwarded well (to the individual entry)...I mean the title in the block "Latest links"....Where to change it on the way that it points to the directory?
keyla31
11-22-2009, 08:28 AM
For some reason the thumbs and links displayed are not bring me to the said site, i know its gotta be simple but cant figure out where to edit to get it to work. Heres the site .
http://www.myenlistment.com
NashChristian
04-18-2010, 06:59 PM
Will this still work with vB4, and can it be used to create a module to display on the vB CMS home page?
Thanks.
BirdOPrey5
06-11-2010, 10:57 AM
Is there a way to pull links from every category except 1? Kind of like there is an option to ignore categories on the newest/random links on the main link page already. Also please confirm that links a user doesn't have permission to see won't be displayed.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.