PDA


View Full Version : Latest or Hot Links Module (CMPS 2.0 RC2)


Gary Bolton
09-12-2005, 03:08 AM
I just want to say first of all, this is NOT my creation. Brian created this for CMPS 1.0.1. But I wanted it so much for CMPS 2.0 RC2 that I have converted it.

Please Read:
This module is only of any use to you if you have both CMPS 2.0 RC2 and the Links Directory 1.0.1 installed on your site.

What It Does:
It grabs links from your "Links Directory and places them on your CMPS page in a module. Go here for more details on what this mod can do:
http://www.vbadvanced.com/forum/showthread.php?t=1977

Changes Made:
The module is now collapsible to match CMPS 2.0 and it also displays the little >> icons against the module title name. Visit my site below to see it installed and working on the LEFT side!!

Installation:
For all of those running both the CMPS and the links directory, here's a module that will allow you to display the latest, highest rated, most viewed, or most replied to links on your CMPS pages. To install, first add these two templates:



adv_portal_latestlinks


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('latestlinks')"><img id="collapseimg_latestlinks"

src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_latestlinks.gif" alt="" border="0" /></a>
<span class="smallfont"><strong>$vba_style[portal_blockbullet] $mods[title]</strong></span></td>
</tr>
</thead>
<tbody id="collapseobj_latestlinks" style="$collapseobj_latestlinks">

$linkbits

</table>
<br />



adv_portal_linkbits


<tr>
<td class="$getbgrow">
<div><a href="$linkurl/showlink.php?$session[sessionurl]do=showdetails&amp;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>



Then download the latestlinks.php attachement below. In the first few lines of the file you will see a place to set the different options. Once you have them set as you would like, upload the file to your /forum/modules directory.

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
Templates Used: adv_portal_latestlinks, adv_portal_linkbits

Use Module Shell Template: No

mholtum
09-12-2005, 03:38 AM
If I used vbadvanced Links, I would use that module.. Looks nice!

Gary Bolton
09-12-2005, 03:43 AM
It's a good one because it intergrates your vBadvanced Links Directory into your portal site. Which is pretty cool to make your links site much better. I have mine setup to display links that are viewed the most. So they rotate much better to get hits from my site.

But its all Brians work, all I have done is made is collapsible and added the little >> to it, nothing more.

lexx27
10-24-2005, 09:31 PM
does this work with 3.5??

Gary Bolton
10-24-2005, 10:11 PM
I'm not sure - you would have to try it.

lexx27
10-24-2005, 10:25 PM
Thanks for the quick reply! If I'll use it I will tell you the results

lexx27
10-30-2005, 09:18 PM
No, its not working :(

oly51
11-02-2005, 08:51 PM
To get it to work with 3.5

In latestlinks.php
Find:$getlinks = $DB_site->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "links AS links
LEFT JOIN " . TABLE_PREFIX . "links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE valid = 1 AND suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");
while ($link = $DB_site->fetch_array($getlinks))

Change to:
$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "links AS links
LEFT JOIN " . TABLE_PREFIX . "links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE valid = 1 AND suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");
while ($link = $vbulletin->db->fetch_array($getlinks))

Hope this helps.

lexx27
11-03-2005, 10:10 AM
thank you very much!!! I will try it and tell you if it works

lexx27
11-03-2005, 12:45 PM
working!!! Its Great-Thanks

oly51
11-03-2005, 11:56 PM
You are welcome. I stumbled on this while updating another hack.

The database call for vB 3.x was "$DB_site->" for 3.5x it is "$vbulletin->db->". This may be useful for other hacks/Mods.

lexx27
11-04-2005, 08:09 AM
I think you are the man that should look the update of the article system ;)

Ramses
11-07-2005, 06:44 PM
Thanks for it Gary and oly

NuFFy
11-08-2005, 06:14 AM
why not use this for template.

adv_portal_latestlinks


$linkbits



adv_portal_linkbits


<tr>
<td class="$getbgrow">
<div><a href="$vboptions[bburl]/links/showlink.php?$session[sessionurl_q]do=showdetails&amp;l=$link[linkid]">$link[name]</a></div>
<div class="smallfont">
$vbphrase[by]
<if condition="$link['userid']"><a href="$vboptions[bburl]/member.php?$session[sessionurl_q]u=$link[userid]">$link[username]</a>
<else />
$vbphrase[guest]
</if><br />
$link[date] <span class="time">$link[time]</span><br />
<a href="$vboptions[bburl]/links/browselinks.php?$session[sessionurl_q]c=$link[catid]">$link[catname]</a><br />
$link[posts] $vbphrase[replies], $link[views] $vbphrase[views]

</div>
</td>
</tr>


just remember to change the 2 instances of $vboptions[bburl]/links/ to the location of where your links folder is. if its in the forum root leave it alone.

then add the modual latestlinks.php and chose Use Module Shell Template option. this will alow your custom template to work properly.

great mod btw just using the default template dident work for me as i couldent click any of the links.

ncangler
11-10-2005, 11:26 AM
I made the latestlinks.php edit change noted above but I get this error message:
Parse error: parse error, unexpected T_VARIABLE in /home/******/public_html/forums/modules/latestlinks.php on line 56

Any ideas?

ncangler
11-10-2005, 04:35 PM
Fixed it. Somehow in copying the code change above a bunch of garbage was added that I couldn't see in BBedit.

theMusicMan
12-14-2005, 04:17 PM
Nope... not for me. Totally screws up my page horrendously. I amended the files as described above but no joy I'm afraid. I'll press on with trying to figure it out.

Diggazz
01-10-2006, 10:26 AM
Nuffy's worked for me

Thanks Awesome hack

VB3.5.3

Lance Carbuncle
01-20-2006, 01:48 PM
Great mod! I have it running on vb3.50 and it looks great.

How can I make it so only the link shows, not the poster, directory, or replies/views?

I apologize in advance for my ignorance.... I am good at following directions, but have no idea how to modify things.....

Running here... http://www.forums.repashy.com/cmps_index.php

Lance

d4v3r5
02-14-2006, 05:03 PM
whoopsie, got this error. when i click on the link on the homepage it takes me to the gallery and spits out this error like 10 times. i'll try hacking at it some more but for now i'm stumped if anybody has any advice.
Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /includes/functions_links.php on line 509

cdembek
03-01-2006, 08:59 AM
Worked just fine.. thanks

d4v3r5
03-08-2006, 09:38 PM
whoopsie, got this error. when i click on the link on the homepage it takes me to the gallery and spits out this error like 10 times. i'll try hacking at it some more but for now i'm stumped if anybody has any advice.
never mind (http://www.vbadvanced.com/forum/showthread.php?t=12418&highlight=Warning%3A+str_repeat%28%29) :)

karlsson
03-24-2006, 02:56 PM
Got it working with the instructions in this thread. Thank you!

But it doesn't show date and time as it did for CMPS 1.x !

It looks like it is designed to have a line for date and time, but
this line is empty.

Does anybody have an idea how to get date and time displayed ? :confused:

KW802
03-24-2006, 04:09 PM
I've got a new site I'm working on that I could use this for so... :p

Attached is an ".module" file that includes the updates to the templates as suggested by Nuffy, the DB call changes as suggested by oly51, and the date & time are fixed so they will also show up now like they did before.

This module was created on a vB 3.5.4 / CMPS 2.1.0 site.

Let me know if any problems/questions.

karlsson
03-24-2006, 04:49 PM
Great!

Now date and time show up!

Thank you for the quick help!

beduino
06-02-2006, 01:44 AM
hello,
I think a copy [or link :)] of this thread is share in vblinks forums...
I search in there and I don't see anything like. Now I will try!
tks
beduino

beduino
06-02-2006, 02:02 AM
hello kevin and friends,
I install and activate this module - latestlinks.php, using diamond skin.
I don't see anything...nothing appears :eek:
It's necessary any change in templates?
tks a lot
beduino
======== templates in use===========
adv_portal_latestlinks
adv_portal_linkbits
================================

beduino
06-12-2006, 01:55 PM
Anybody? :)

DaleBrown
06-27-2006, 03:39 AM
me too same problem tried these options and nada nothing shows up at all.

KW802
06-27-2006, 11:01 AM
I haven't played with this module lately. I'll try to take a look today at some point.

beduino
08-17-2006, 01:08 AM
hello kevin and friends....
any solution?
i will upgrade all [vB/vBa and vBlinks] to last versions.
vb links it's a great idea - but noboby visits because is much difficult to find ...
the module of vBa increase the use.
tks
joao luis barroca
aka
beduino

MotoUp
08-31-2006, 02:48 PM
Has anyone ported this for 3.6.0 yet?

Gord
09-04-2006, 06:06 PM
I love this module. It works great with vb 3.6 too.

Thanks guys :) :)

Gord
09-04-2006, 06:13 PM
Has anyone ported this for 3.6.0 yet?

It worked right away for me after I made the wee alteration to the php file as indicated above. Check it out on my new golf website: www.moongolfer.com

cheesegrits
10-02-2006, 01:36 PM
If anyone is trying to use this module with Links 2.0, you will need to make the following change to latestlinks.php in your ./modules directory.

Find the database query about half way down the file:

$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "links AS links
LEFT JOIN " . TABLE_PREFIX . "links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE valid = 1 AND suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");
... and replace it with:

$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "adv_links AS links
LEFT JOIN " . TABLE_PREFIX . "adv_links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE links.valid = 1 AND links.suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");

This seems to have done the trick on my site, I'll update this thread if I find any more issues with this mod and Link v2.

-- hugh

Spikeman
10-08-2006, 05:10 AM
Saved me some time thanks cheesegrits:)

nostalgia
10-19-2006, 01:00 PM
If anyone is trying to use this module with Links 2.0, you will need to make the following change to latestlinks.php in your ./modules directory.

Find the database query about half way down the file:

$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "links AS links
LEFT JOIN " . TABLE_PREFIX . "links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE valid = 1 AND suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");
... and replace it with:

$getlinks = $vbulletin->db->query("
SELECT $votequery links.*, links_categories.title FROM " . TABLE_PREFIX . "adv_links AS links
LEFT JOIN " . TABLE_PREFIX . "adv_links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE links.valid = 1 AND links.suspended = 0 $privcats
ORDER BY $orderby
LIMIT $limit
");

This seems to have done the trick on my site, I'll update this thread if I find any more issues with this mod and Link v2.

-- hugh

I'm really Thanks for you~ cheesegrits!!!
I did it !!!

Works fine(got little problem but I can fix it ^^) ~~~~

VB3.6.2 + CMPS 2.2.1 + Links D. 2.0rc1

nostalgia
10-21-2006, 11:15 AM
I got problem with order4 (for highest rated).
How can I fix?
Please help....
Cheesegrits !! Please can you help me?


Order 1, 2, 3 is perfect.

This error caused by order4.
Database error in vBulletin 3.6.2:

Invalid SQL:

SELECT IF(votenum >= , votenum, 0) AS votenum, IF(votenum >= AND votenum> 0, votetotal / votenum, 0) AS voteavg, links.*, links_categories.title FROM adv_links AS links
LEFT JOIN adv_links_categories AS links_categories ON (links.catid = links_categories.catid)
WHERE links.valid = 1 AND links.suspended = 0
ORDER BY voteavg DESC, votenum DESC
LIMIT 5;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' votenum, 0) AS votenum, IF(votenum >= AND votenum> 0, votetotal / votenum, 0) ' at line 1
Error Number : 1064
Date : Saturday, October 21st 2006 @ 11:12:51 PM


Thanks ~~

mrderanged
11-13-2006, 04:33 PM
Sorry to go off topic, but is there anything like this for standard vB 3.6x forumhome? Any ideas on how to go about it? Searched and couldn't find anything....

Thanks

Marko777
11-24-2006, 01:26 PM
I am also interested in adding this to the original forum homepage.

Could someone write some file hich we can include into our php code?

Thank you.