View Full Version : Fake vBalinks as forum
Lionel
06-01-2008, 01:12 AM
This requires a small file edit and will simulate vBalink as a forum, displaying latest link in forumhome
Replace /showcase/ with your links directory foldername
Ramses
06-01-2008, 06:16 AM
Nice work, thank you Lionel.
Thank you Lionel. I have not tried it yet (as I have to solve another problem first). But I definately like the idea. One question: Could it be possible to take a new link from a specific link category to a specific forum category (instead of all link categories to forum home) ? So instead of a parrot link goes to forum home it goes to the parrot forum.
You could extend this idea even further - so every link would has its own link in its own forum category. This would incorporate the vbalinks even tighter to the forum. Just an idea... :)
Lionel
06-01-2008, 07:14 PM
Sure it's possible. You create as many forums as you want and link them to the category. Then you add a WHERE categoryid clause for each query.
But why would you do that? Would be simpler to do one forum and link it to your main links folder where you have all info already the way you want it.
Parabellum
06-01-2008, 11:44 PM
Thank you! Just what I was looking for.
How can I get it to show the amount of posts in the link directory? It only shows threads.
Thanks Again
Lionel
06-02-2008, 12:00 AM
Do you have any posts for the last link in there? They should display
$forum['replycount'] = $link['posts'];
Parabellum
06-02-2008, 12:03 AM
the latest link has no posts but the link directory it self does in other links
Lionel
06-02-2008, 12:06 AM
It display last post info for the last link only. To get for entire directory you would need to add another query to get it
Parabellum
06-02-2008, 12:10 AM
what is the code I would need to add to get the total amount of posts for the link directory.
Thank you for your time! :)
Lionel
06-02-2008, 12:15 AM
On top of my head (not tested)
$totpost = $db->query_first("SELECT SUM(posts) as totpost FROM " . TABLE_PREFIX . "adv_links");
and replace with
$forum['replycount'] = $totpost['totpost'];
Parabellum
06-02-2008, 02:22 AM
I tried it with this code and it worked :D
I just added the code you gave me without replacing any. So far no problems that I can find.
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links");
$totpost = $db->query_first("SELECT SUM(posts) as totpost FROM " . TABLE_PREFIX . "adv_links");
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $totpost['totpost'];
Lionel
06-02-2008, 02:53 AM
Cool. You could also fine tune the date by adding the extra css to the span. I think it's class="time" . This way the font will be the same size with the rest of your dates, and make the link title "smallfont" as it appears to be "smallfont" in your forumhome
Parabellum
06-02-2008, 03:51 AM
Changed the fonts like you said and looks perfect just like the rest of the forum. Thank you for all the help! :)
Here is the link to my site with this great mod in action Demo (http://www.promotemyforum.com/forums)
Lionel
06-02-2008, 03:55 AM
Post the link to your site for those who would want to see it, but are too lazy to click on your name or will not see it on the page or would not know to look in forums :-)
ozwebsites
06-03-2008, 02:37 AM
I cannot get this working :(
And its a great little hack.
we have links directory in our domain root.
forum is under /forum
Have done the changes,
if ($forum['forumid'] == '43')
{
global $db;
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links");
$link = $db->query_first("SELECT linkid , name, posts, username, userid, dateline FROM " . TABLE_PREFIX . "adv_links ORDER BY linkid DESC");
$date = vbdate($vbulletin->options['dateformat'], $link['dateline'], 1);
$time = vbdate($vbulletin->options['timeformat'], $link['dateline']);
$forum['lastpostinfo'] = '<div align="left"><strong><a href="/links/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/links/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="images/buttons/lastpost.gif" border="0" alt="View "></a></span></div>';
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $link['posts'];
}
Have set up a new forum, id 43
Dont work....
Any suggestions?
Ozzy
Lionel
06-03-2008, 09:19 AM
Did you link the forum? What happens when you click on it?
ozwebsites
06-03-2008, 04:52 PM
Did you link the forum? What happens when you click on it?
Well,, I was presuming this hack... actually posts new links into the forum thread, on forum home page.
So in the code you gave, we have replaced xx with the forum id.
Am i missing something really obvious?
ozwebsites
06-03-2008, 06:19 PM
Here is what we have.
in ourwebsite.com/links
we have a category child called links.
we have changed includes/functions_forumlist.php
to..
if ($forum['forumid'] == '43')
{
global $db;
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links");
$link = $db->query_first("SELECT linkid , name, posts, username, userid, dateline FROM " . TABLE_PREFIX . "adv_links ORDER BY linkid DESC");
$date = vbdate($vbulletin->options['dateformat'], $link['dateline'], 1);
$time = vbdate($vbulletin->options['timeformat'], $link['dateline']);
$forum['lastpostinfo'] = '<div align="left"><strong><a href="/links/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/links/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="images/buttons/lastpost.gif" border="0" alt="View "></a></span></div>';
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $link['posts'];
}
In admincp, for forums, we have created a forum with id 43 called links
So where are we going wrong?
When somone posts a link, in the vbalinks it doesnt appear on forum/links thread as this hack would suggest.
Im sure we have got paths correct.
Ozzy
Lionel
06-03-2008, 09:47 PM
Just re-read simple instructions.
ozwebsites
06-03-2008, 09:50 PM
Actually no they werent lol, well to me anyway.
Have just got this working ^5 to you.
Just so other eegits like me dont make the same mistake.
In forum manager, create a new forum, and then link that forum, back to your VBALINKS
Give it absolute url.
Sorted at last, great hack.
NEXT ! :D
Lionel
06-03-2008, 09:54 PM
sorry if this was confusing to you
Create a forum and point it to your links index
PhilMcKrackon
06-15-2008, 06:35 PM
I added this to my forums but I wanted the individual categories to show instead of one to the complete links section (since my site is based around links). http://www.legendarythreads.net/forums/
I'm concerned because I could not figure out a way to do this without repeating the code multiple times, this adds many queries per page load and I'm trying to lighten the query count. Is there a way to combine the code below into less queries?
if ($forum['forumid'] == '18')
{
global $db;
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links WHERE catid = 17");
$link = $db->query_first("SELECT linkid , name, posts, username, userid, dateline FROM " . TABLE_PREFIX . "adv_links WHERE catid = 17 ORDER BY linkid DESC");
$totpost = $db->query_first("SELECT SUM(posts) as totpost FROM " . TABLE_PREFIX . "adv_links WHERE catid = 17");
$date = vbdate($vbulletin->options['dateformat'], $link['dateline'], 1);
$time = vbdate($vbulletin->options['timeformat'], $link['dateline']);
$forum['lastpostinfo'] = '<div align="left" class="smallfont"><strong><a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="http://www.legendarythreads.net/forums/smooth/buttons/lastpost.gif" border="0" alt="View showcase"></a></span></div>';
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $totpost['totpost'];
}
if ($forum['forumid'] == '20')
{
global $db;
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links WHERE catid = 7");
$link = $db->query_first("SELECT linkid , name, posts, username, userid, dateline FROM " . TABLE_PREFIX . "adv_links WHERE catid = 7 ORDER BY linkid DESC");
$totpost = $db->query_first("SELECT SUM(posts) as totpost FROM " . TABLE_PREFIX . "adv_links WHERE catid = 7");
$date = vbdate($vbulletin->options['dateformat'], $link['dateline'], 1);
$time = vbdate($vbulletin->options['timeformat'], $link['dateline']);
$forum['lastpostinfo'] = '<div align="left" class="smallfont"><strong><a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="http://www.legendarythreads.net/forums/smooth/buttons/lastpost.gif" border="0" alt="View showcase"></a></span></div>';
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $totpost['totpost'];
}
Thanks - and BTW - nice hack Lionel.
ozidoggy
06-29-2008, 01:46 AM
Cool. You could also fine tune the date by adding the extra css to the span. I think it's class="time" . This way the font will be the same size with the rest of your dates, and make the link title "smallfont" as it appears to be "smallfont" in your forumhome
Can someone please explain to me how and where I place this piece of code?
Thanks
By the way GREAT mod!
PhilMcKrackon
06-29-2008, 08:06 AM
Can someone please explain to me how and where I place this piece of code?Look at my example just above your post. You can see where I have placed class="smallfont" to control the font size on the $forum['lastpostinfo'] line (3rd from last).
ozidoggy
06-29-2008, 08:23 AM
Thanks Phil..... :)
OneShot
06-30-2008, 06:12 PM
Would it be possible to make a Plugin out of this instead of modifying one of the files directly? I tried, unsuccessful tho. Its a neat little feature and I'd love to have it but since I want to keep my workload on updates small I refrain from using any hacks which involve hacking files directly.
Thanks
Lionel
06-30-2008, 06:14 PM
In order to make a plugin, you need a hook at a specific location. If there is no such hook, then a file edit is required if you want to use it.
Janfri
10-19-2008, 12:59 AM
I installed this mod on my site and it works. But the problem for me is, that it is not valid XHTML 1.0 Transitional and gives me 22 errors on W3C, for example related to character "&" is the first character of a delimiter but occurred as data. I ask myself why so many mods here and on vbulletin.org are not XHTML 1.0 Transitional when vbulletin is. Wouldn't it be better to use the same language? I didn't validate my pages before and installed lots of mods. But when I validatet them the other day, I found over 200 errors on my homepage, and all because of the code of the mods. I would really like to use this solution for the link directory. So I would like to ask if you consider this important and if I can reinstall the mods anyway?
Best regards
Janfri
Lionel
10-19-2008, 01:38 AM
Simply replace div align="left"><strong><a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="images/buttons/lastpost.gif" border="0" alt="View showcase"></a></span></div>with (substituting the bold with your path and alt wording)
div align="left"><strong><a href="/showcase/showlink.php?do=showdetails&l=' . $link[linkid] . '">' . $link[name] . '</a></strong><br />by <a href="member.php?find=lastposter&f=' . $link[userid] . '">' . $link[username] . '</a><br /><span style="float:right;">' . $date . ' ' . $time . ' <a href="/showcase/showlink.php?do=showdetails&l=' . $link[linkid] . '"><img src="images/buttons/lastpost.gif" border="0" alt="View showcase" /></a></span></div>99% of the time, one single error will cause the validator to be confused and display lots of errors.
So if a mod is causing 200 errors, you'll be surprised that fixing only the first one will change that 200 into a dastically lower errors, such as 5
Most of the mods that I posted for free are from my 9 years old site and that's not an important issue for me. If that is causing grief, then I will stop posting them.
Janfri
10-19-2008, 02:00 AM
So if a mod is causing 200 errors, you'll be surprised that fixing only the first one will change that 200 into a dastically lower errors, such as 5.
With your help my site has drastically lower errors now, not 5 but 0.:) The mod works perfectly and the page is validate without errors. Thanks bunches, that was very helpful. I'm afraid I will have to learn XHTML coding to be able to fix this kind of issues myself.
Best regards
Janfri
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.