Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2011, 09:19 PM
stevo_s stevo_s is offline
 
Join Date: Nov 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Latest Active Threads on Forumhome

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>
which comes out as

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
Reply With Quote
  #2  
Old 04-15-2011, 11:29 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 />");
Reply With Quote
  #3  
Old 04-16-2011, 08:23 AM
stevo_s stevo_s is offline
 
Join Date: Nov 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do I need to create plugins if it is live and working fine as is?
Reply With Quote
  #4  
Old 04-16-2011, 11:29 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by stevo_s View Post
Do I need to create plugins if it is live and working fine as is?
As far as I know, yes, because the forum name and id are not available the way it is.

If someone else has an alternative, please post it.
Reply With Quote
  #5  
Old 04-16-2011, 12:14 PM
stevo_s stevo_s is offline
 
Join Date: Nov 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It wont break anything long term though will it?
like I say it is working fine as is on the forumhome.
Reply With Quote
  #6  
Old 04-16-2011, 12:28 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 04-16-2011, 01:13 PM
stevo_s stevo_s is offline
 
Join Date: Nov 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 04-16-2011, 01:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh...yeah, that only requires template edits so you don't need any plugins for that.
Reply With Quote
  #9  
Old 04-16-2011, 01:35 PM
stevo_s stevo_s is offline
 
Join Date: Nov 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #10  
Old 04-16-2011, 01:45 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:31 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08424 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete