![]() |
Improved Thread Preview Hack
The idea for this hack was originally that of Parker Clack, a regular here on vBulletin.org.
What this hack does: Basically, this hack pops up a little box/window when the mouse is run over a thread title that shows the first three hundred characters of the first post in the thread (that is, the post that started the thread). Improvements to Parker Clack's hack:
Versions: 3.0: Overgrow's search page thread preview instructions. 2.1: Added some necessary instructions. 2.0 Reduced MySQL queries significantly. 1.0 Initial release. Comments appreciated... :) A version for vbHacker is available here - note: some files may need fixing afterward if they present parse errors! How to Censor Previews (by nakkid) See page seven of this thread. A very important security fix is available here - I have not updated the ZIP, so install it after you install the hack |
HEY that is really nice. I like it, flawless installation and very simple code.
I don't like that it adds a query on the post table for each thread listed.. that's an extra 40 or 50 queries with each forumdisplay. Is it possible to compile a list of all threads that will be displayed on the page and then run one query and pull all the post info at once? Right now I have it only operating for admins since I don't want to add so much extra load. Thanks, nice work. |
as far as i know, the choices are a) store the same data twice for every single thread or b) run a few extra queries! :)
maybe someone can prove me wrong or i can ponder it for awhile |
yeah...looking at it, i'm almost positive the only way is to run extra queries
|
Nope, a join will do it. I've got it re-written..
old way: mysql things 1.10 seconds new way: mysql things 0.09 seconds Only problem is it joins the post table again which won't work if you have dotqueries turned on. It will take a little more re-writing to get it to work with dotqueries. PHP Code:
|
You want to finish it up? :D
|
okay...thanks...i'll test that out and issue an update
|
well....i got a database error. i must have done something wrong.
|
Database error in vBulletin 2.2.2:
Invalid SQL: SELECT DISTINCT post.userid, post.pagetext as pagetext, icon.title as icontitle,icon.iconpath, thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid, lastposter,thread.dateline,views,thread.iconid, notes,thread.visible,sticky,votetotal,attach FROM thread LEFT JOIN icon ON (icon.iconid = thread.iconid) LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1') LEFT JOIN post ON (thread.firstpostid = post.postid) WHERE thread.threadid IN (0,13,16) ORDER BY sticky DESC, lastpost DESC mysql error: Not unique table/alias: 'post' mysql error number: 1066 Date: Sunday 03rd of March 2002 03:08:13 AM Script: http://www.60schevytrucks.com/forums...p?s=&forumid=6 Referer: http://www.60schevytrucks.com/forums...s=&threadid=13 |
Yup, you have dotqueries turned on. Go to your admin Cpanel and turn off "Use dot icons" -- I did point that out as a problem in my previous post :) It is trying to join the post table twice. You'll have to write an exception to check if dotqueries is turned on and if it is, change the join again.
I don't use the dots since I didn't think the join was worth it.. but for me, the join is worth it for the preview. |
All times are GMT. The time now is 10:25 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|