The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi - I'm using this in VB 3.8 :
http://www.vbulletin.com/forum/showt...s-on-Forumhome Code:
<script language="" type="text/javascript">
<!--
for (x = 0; x < 5; x++)
{
document.writeln("<img class=\"inlineimg\" src=\"$stylevar[imgdir_button]/lastpost.gif\" alt=\"\" border=\"0\" /> <a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> <span class=\"time\">($vbphrase[posted_by]: "+threads[x].poster+")</span><br />");
}
//-->
</script>
Thread title1 (Posted By: username1) Thread title2 (Posted By: username2) Thread title3 (Posted By: username3) and it works fine. but any idea how I would get it to display the forum name as well and have the forumname linkable as well?: Thread title3 (Posted By: username3) in Forum4 |
|
#2
|
|||
|
|||
|
You can do it, but you need to create two plugins.
First, using hook external_query and code Code:
$hook_query_fields .= " , forum.title AS forumname "; Second, using hook external_complete and code Code:
if ($vbulletin->GPC['type'] == 'JS')
{ // javascript output
$output .= "
function forum(forumname, forumid)
{
this.forumname = forumname;
this.forumid = forumid;
}
";
$output .= "var forums = new Array(" . sizeof ($threadcache) . ");\r\n";
if (!empty($threadcache))
{
foreach ($threadcache AS $threadnum => $thread)
{
$thread['forumname'] = addslashes_js(htmlspecialchars_uni($thread['forumname']));
$output .= "\tforums[$threadnum] = new forum('$thread[forumname]', $thread[forumid]);\r\n";
}
}
}
Then you also need to edit the FORUMHOME template, find the code you added, and replace the line that starts with document.write with Code:
document.writeln("<img class=\"inlineimg\" src=\"$stylevar[imgdir_button]/lastpost.gif\" alt=\"\" border=\"0\" /> <a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> <span class=\"time\">($vbphrase[posted_by]: "+threads[x].poster+")</span> in <a href=\"forumdisplay.php?f="+forums[x].forumid+"\">"+forums[x].forumname+"</a><br />");
|
|
#3
|
|||
|
|||
|
Do I need to create plugins if it is live and working fine as is?
|
|
#4
|
|||
|
|||
|
Quote:
If someone else has an alternative, please post it. |
|
#5
|
|||
|
|||
|
It wont break anything long term though will it?
like I say it is working fine as is on the forumhome. |
|
#6
|
|||
|
|||
|
Well, it's true whenever you add a plugin it's possible that it will cause a problem someday when you upgrade, so you have to weigh that against how much you want the mod. In this case I don't think there's too much risk.
I'm more a programmer and I'm not familiar with all the mods that are available, so if you feel better installing a product, maybe there's something else out there that will do what you want. |
|
#7
|
|||
|
|||
|
Sorry what I mean is it safe to jsut add the code from here:
http://www.vbulletin.com/forum/showt...s-on-Forumhome rather than needing to make a plugin first as it works fine. |
|
#8
|
|||
|
|||
|
Oh...yeah, that only requires template edits so you don't need any plugins for that.
|
|
#9
|
|||
|
|||
|
cool- any idea how I'd get
Thread title3 (Posted By: username3) in Forum4 rather than just Thread title3 (Posted By: username3) Code:
<script language="" type="text/javascript">
<!--
for (x = 0; x < 5; x++)
{
document.writeln("<img class=\"inlineimg\" src=\"$stylevar[imgdir_button]/lastpost.gif\" alt=\"\" border=\"0\" /> <a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> <span class=\"time\">($vbphrase[posted_by]: "+threads[x].poster+")</span><br />");
}
//-->
</script>
|
|
#10
|
|||
|
|||
|
Sorry, you lost me now. Like I said, you can't do it without plugins.
I'm out - anyone else want to take a shot at this? |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|