Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 05 Jun 2012, 16:11
addamroy addamroy is offline
 
Join Date: Sep 2010
Placing SIMILAR THREADS Box under First Post or somewhere else instead of LAST

Hello, I've been trying like crazy to get this similar threads box under the first post instead of the last post.

Well in fact, I'd like to be able to put the similar threads box wherever I want it I just can't figure out how to use the {vb:raw similarthreads} tag....

This tag only seems to work in the SHOWTHREAD template.

I tried removing it and placing it at the end of the postbit_legacy template but this didn't do anything, nothing showed up.

I removed the {vb:raw similarthreads} tag from the showthread template and it no longer shows on the at the bottom, which tells me at the very least this is the tag that displays the similar threads box, but why is it that I can't place this tag anywhere else in other templates and have it show up?

The end goal, is to have a simple <vb:if is_first_shown>{vb:raw similarthreads}</vbif> (excuse the lack of proper code, just throwing examples out there) type entry in the postbit_legacy template at the bottom... but either way no matter where I put the {vb:raw similarthreads} tag it doesn't work, unless it's in the showthread template.

Ideas? Reason?

Thanks!
Reply With Quote
  #2  
Old 08 Jun 2012, 03:41
addamroy addamroy is offline
 
Join Date: Sep 2010
Anyone?
Reply With Quote
  #3  
Old 19 Jun 2012, 12:16
addamroy addamroy is offline
 
Join Date: Sep 2010
Can somebody please help me here?? In a step-by-step fashion?
Reply With Quote
  #4  
Old 19 Jun 2012, 14:52
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
The reason you can't put {vb:raw similarthreads} in the postbit_legacy template is because a variable has to be registered to a template before you can use it in a vb:raw tag. In addition, the similarthreads section hasn't even been created yet when the posts are being rendered, so there's no way to simply register similarthreads to the postbit_legacy template.

The only (relatively easy) thing I can think of would be to create a plugin using hook showthread_complete. At that point the similar threads section has been created and is in $similarthreads, and the posts section has been created as $postbits. So what you might be able to do is do a str_replace() on $postbits to insert the similar threads, then unset $similarthreads, like:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


That leaves the question of what to use as "something" and how to get it into postbit_legacy. I was thinking something like an html comment (so if the plugin is disabled it won't be displayed), so maybe "<!-- similar threads -->". Then you'd use something similar to what you posted above, maybe


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Anyway, I haven't actually tested this so you might run in to some issues.
Reply With Quote
  #5  
Old 19 Jun 2012, 19:59
addamroy addamroy is offline
 
Join Date: Sep 2010
Well although that makes perfect sense, (it really does) I haven't got a clue how to use 'hooks' or how to create 'plugins' lol
Reply With Quote
  #6  
Old 19 Jun 2012, 20:09
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
OK, you did say you wanted step by step. Thing is I haven't tried it so I could step by step you into something that doesn't actually work. But here goes:

1) Edit postbit_legacy, and where you want the similar threads to appear (at the end I suppose), insert this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


2) In the adminCP go to Products & Plugins > Add New Plugin, and find "showthread_complete" in the Hook Location dropdown.

3) Enter a title, something so that later you'll remember what this plugin is for.

4) In the large "Plugin PHP Code" box, enter this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


5) Select the Yes radio button next to Plugin is Active at the bottom, and click Save.


There's a chance it won't work. If it doesn't, post here and maybe I'll have to actually try it.
Reply With Quote
  #7  
Old 19 Jun 2012, 21:18
addamroy addamroy is offline
 
Join Date: Sep 2010
Thanks man you are truly awesome, we're getting somewhere.

What you said works, HOWEVER, just a little bit of formatting issues it seems.

If you recreate what you said (shouldnt cause any issues), it doesn't look the same as it does under the posts like where it shows by default. If we can fix that we're golden!
Reply With Quote
  #8  
Old 19 Jun 2012, 21:30
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
The problem I have (and the reason that I didn't test this before posting) is that I've never been able to get similar threads to work on a test forum. I really don't understand how they work - I used exactly the same word in the title and body of several threads but they still didn't score high enough to be considered "similar".

Anyway, I was afraid that the formatting might not be right, and I'm not big on the formatting stuff. You probably need to copy more of the surrounding formatting from the SHOWTHREAD template. Try this (where you modified the postbit_legacy template):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #9  
Old 19 Jun 2012, 21:33
addamroy addamroy is offline
 
Join Date: Sep 2010
It's basically removing the extra 'spacing' between posts for some reason. It is there though!

--------------- Added 19 Jun 2012 at 21:34 ---------------

Perfect!

--------------- Added 19 Jun 2012 at 21:42 ---------------

kinda bummed out it wont let me thank you again until i thank someone else...... sup with that
Reply With Quote
  #10  
Old 19 Jun 2012, 22:13
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
lol...I guess it's designed to make you spread it around. It's OK, glad you got it working.
Reply With Quote
  #11  
Old 23 Jun 2012, 21:49
christon26 christon26 is offline
 
Join Date: Dec 2008
Real name: Lissa
kh99 thank you so much for the help you give in this thread, after much searching to find what I wanted I used your coding (with changes for vb3 lol) on my board, example here: http://www.digiscrapforum.com/showthread.php?t=2287 I think it looks much nicer than the old display :P
__________________
-- I have just enough php knowledge to make me dangerous :P --
Reply With Quote
  #12  
Old 18 Feb 2013, 20:21
bada_bing's Avatar
bada_bing bada_bing is offline
 
Join Date: Feb 2004
Hey everyone, great article and looking to do the exact same think, Is this for vb 3.8 ? I get an error when trying to add the code to my postbit_legacy

Thanks
__________________
A Leader and initiator.
Reply With Quote
  #13  
Old 19 Feb 2013, 07:10
Amaury Amaury is offline
 
Join Date: Nov 2011
Real name: Amaury
Originally Posted by bada_bing View Post
Hey everyone, great article and looking to do the exact same think, Is this for vb 3.8 ? I get an error when trying to add the code to my postbit_legacy

Thanks
This is for vBulletin 4 if you look at the forum name. However, you should create your own thread for this.
__________________
I am a former vBulletin user and am no longer regularly active here.

KH-Flare moved to XenForo on January 1, 2014.
Reply With Quote
  #14  
Old 19 Feb 2013, 11:10
bada_bing's Avatar
bada_bing bada_bing is offline
 
Join Date: Feb 2004
Originally Posted by Amaury25 View Post
This is for vBulletin 4 if you look at the forum name. However, you should create your own thread for this.
Thanks for a worthless response
__________________
A Leader and initiator.
Reply With Quote
  #15  
Old 19 Feb 2013, 13:59
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
You could try using this in your postbit or postbit_legacy template:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


then it seems like the same plugin code should work.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 20:40.

Layout Options | Width: Wide Color: