vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Improved Thread Preview Hack (https://vborg.vbsupport.ru/showthread.php?t=35645)

N!ck 03-03-2002 06:11 AM

hmmm. k thanks

Overgrow 03-03-2002 06:11 AM

Also you might want to use this regular expression to modify the pagetext-- it will remove the vBCode for a cleaner display:

PHP Code:

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]); 

HEY THIS PHP PARSER IS EATING MY REGEX..... do not use the above code.. I'm leaving it there to point out a flaw in vB's php code thingy... here is the correct regex

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);

(notice the slashes)

Overgrow 03-03-2002 08:33 AM

Quotes also screw up the preview.. so I'm using these two lines to clean up the display:

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);
$thread[pagetext]=str_replace("\"","",$thread[pagetext]);

Parker Clack 03-03-2002 12:44 PM

nick:

I had tried to use something like this originally when I wrote this but the extra queries to the database on my large board just about brought it to its knees. So Bira, Chen and wluke came up with the coding to use, as is included with the original hack I wrote, so that it doesn't take up some much in the way of system resources. Either way will work. Thanks for posting another way of doing this.

You might want to have Chen, Bira or wluke to look over the code this code too to see what they think.

Parker

Parker Clack 03-03-2002 12:45 PM

Overgrow:

Those two lines didn't remove any of the quotes from the text preview. The UBB code is removed though now.

Parker

Overgrow 03-03-2002 02:05 PM

Hi Parker, great idea for a hack.

I do believe that the JOIN is the way this should be done. It may never work properly with dot-icons since they both want to join the same query, but this is definitely the most efficient way-- there is no duplicate DB data in the thread table and it does not add 50 extra queries with each forumdisplay.

re: quotes... those two lines I put up above, the preg_replace and str_replace do work for me. The first removes vBCode and the second removes quotes. The second is very simple.. replace a quote with nothing, it works for me just fine.

Freddie Bingham 03-03-2002 03:20 PM

Maybe this will help you out a bit
Code:

SELECT DISTINCT post.userid, post2.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
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 AS post2 ON (thread.firstpostid = post2.postid)
WHERE thread.threadid IN (0,13,16)
ORDER BY sticky DESC, lastpost DESC


Overgrow 03-03-2002 03:28 PM

BRILLIANT. I had no idea you could do that ;)

nick, this is definitely possible to do with a JOIN and not have redundant info in the DB and not add any more queries and have it work with doticons. Yell if you want ideas on putting it all together.

Overgrow 03-03-2002 03:29 PM

ps. this would be a great feature for v3. I expect it to actually cut bandwidth as people stop clicking on posts that don't really interest them.

N!ck 03-03-2002 05:09 PM

this has gotten over my head :)

i get errors with freddie's ('cause of the dotqueries thing?)...and the guy that hosts my site doesn't know what dotqueries are...and i'm not sure exactly what to tell him.


All times are GMT. The time now is 09:31 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01213 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete