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)
-   -   Preview the first post in a thread first. (https://vborg.vbsupport.ru/showthread.php?t=33070)

Parker Clack 12-16-2001 10:00 PM

Well after attempting to do this before I found that it was making too much of a load on the server so I redid it.

After getting advice from Chen, bira and wluke I have finally gotten this done.

It allows a member to preview the first post in a thread, in your forumdisplay page, by putting their mouse pointer on the thread title. A separate box pops up with the first 500 characters of that post in it so you can preview the message before going into the rest of the thread.

This only works with IE and Opera. It works partially with Netscape (what else is new!).

Upload the attached .php file to your main forum directory and run it. Then read the included readme.txt file for instructions on the modifications needed to your files and templates.

(I have updated the file and put in a later post)

Parker

[high]The hack's zip file can be found in post #7 of this thread[/high]

bira 12-17-2001 03:11 AM

Parker Clark, I love this. I am going to install it now on my BB - thank you.

Hooper 12-17-2001 03:20 AM

Thanks Parker. Works super. Nice Idea.

bira 12-17-2001 05:16 AM

Hope you don't mind, Parker, but this hack got me so excited, I wrote a little script that updates the preview for existing threads since whichever date you select.

Upload the attachment to your admin directory and run it there. Select the date limit for activity -- all threads which were updated since (note: UPDATED, not just CREATED) will have their preview added.

It's very quick. I ran it on my BB and it took some 8 seconds in all to update 8,000 active threads. I won't bother updating the rest cos they are inactive anyway.

bira 12-17-2001 05:18 AM

ooops, forgot to attach :D


oh, and by the way, here's what it looks like:

http://www.atlasf1.com/personal/bira...re-preview.gif

(I love this hack Parker, you can't imagine how much time it will save me!!!)

Parker Clack 12-17-2001 05:25 AM

bira:

Thanks for the kudos and the additions. I will add them to the
upload.

It is really wild as the edit function that you wrote is the exact one that I just got thru doing.

Thanks again for all your help.

Parker

Parker Clack 12-17-2001 06:26 AM

Here is the updated .zip file with all the latest additions and bira's update_preview.php file.

Parker

FWC 12-19-2001 05:43 PM

Parker, I agree with Bira. This is a wonderful hack. My users love it! :)

Lionel 12-19-2001 09:22 PM

Can that be used with those threads grabber (last 10 posts) hacks that we place on site homepage?

Tommy Boy 12-19-2001 11:30 PM

Damn, what a great idea! I almost couldn't stop myself from installing it! :D

The only problem with it is that it increases the pages size significantly. In my tests, it doubled the page size, and that's pretty significant for modem users, like myself. How about making it optional, on a per-user basis, in the control panel?

BTW: You should trim() the text before storing it in the database, and also maybe get rid of repeating spaces and line breaks. Oh, and how about previewing redirects as well? ;)

Great job everybody!

bira 12-20-2001 12:49 AM

on a 40-threads page, the addition on my Bulletin Board was 10-15 kb.

The total page, with images and all, without the preview is 129kb; with the preview it's 144kb -- total of 15 kb more.

Using gzip compression (which I do), the difference is more significant and at the same time less so:

without the preview the page (without images) is 8106 bytes (8 kb). With the preview, the page is 14,323 bytes (14 kb).

Maybe because we use gzip compression, no one has so far complained about the page loading slower. But it is a point to think about if you are trying to cut down on bandwidth.

I might suggest, though, that those users who connect with modems should edit their own options to include less topics per page. If they are on a particularly slow connection, they ought to go for 10 topics per page.

Parker Clack 12-20-2001 02:20 AM

Lionel:

I didn't write that hack so you would have to ask the author about doing that. Good idea though.

Tommy Boy:

If you want to make this an option to use on your board click on the below .zip file and follow the instructions.

The default is set to off so if a member wants to use it they will have to turn it on.

Also, if you know how to change the tables around alter the preview add on to the thread table, that you just made, from 500 to 250 and change it from medium text to varchar(250) then change the 500 count in the .php files you just changed to 250.

Bira:

Look this new .zip over and if you see anything that needs changing let me know. Thanks.

Parker

bira 12-20-2001 05:09 AM

Parker I downloaded it and had a look. What is fundementally missing, is the code that is needed to be added to the user's Edit Options template :)

Likewise, you might want to expand it and add the same thing to user.php for the Admin CP user page.

Otherwise it looks good (though I've not tried it yet) :up:

Parker Clack 12-20-2001 08:29 AM

Doh!

I guess that would be necessary eh?

In your modifyoptions template you need to look for

$maxpostsoptions
</select></smallfont></td>
</tr>

and just below this add:

<tr>
<td bgcolor="yourcolorhere"><normalfont><b>Thread Preview Option On?</b></normalfont><br>
<smallfont>Selecting yes will allow you to preview the first post in a thread by putting your mouse pointer on the thread title.</smallfont></td>
<td bgcolor="yourcolorhere"><normalfont>
<input type="radio" name="threadpreview" value="yes" $threadpreviewchecked> yes
<input type="radio" name="threadpreview" value="no" $threadpreviewnotchecked> no
</normalfont></td>
</tr>

I will work on the Admin CP bit.

Thanks,
Parker

Princeton 12-21-2001 12:34 AM

Great hack ... I love it. Thanks Parker. Bira, thank you for that update_preview. I was wondering why an existing link didn't show a preview waahoooo :D .

Sadie Frost 12-21-2001 03:14 AM

This is so great!

One (stupid) question - should I now delete the threadpreview.php file?

:)

FWC 12-21-2001 03:47 AM

[QUOTE]Originally posted by Sadie Frost
One (stupid) question - should I now delete the threadpreview.php file?

:)

Sadie Frost 12-21-2001 11:18 AM

Thank you! Just didn't want to totally screw it up after I got it working lol :)

Parker Clack 12-21-2001 01:26 PM

Sadie:

Yeah, you can delete the previewthread.php and the previewthreadoptions.php files as they just make the mods to the database.

Thanks for the kudos guys and gals and I appreciate the fact that your members get something out of it. I know ours do.

Thank God there are people around here that know what they are doing though as the first version of this that I wrote was a real resource hog. This version works well on our board with over 22,000 registered and 6 million page views a month.

Parker

freakyshiat 12-22-2001 02:22 PM

great work guys!!!

Now, could one of you outline the steps one more time just to be sure users dont screw things up? :)

Sadie Frost 12-22-2001 06:07 PM

Just fyi - this hack conflicts with the custom post prefix hack, so you have to be careful to combine the two hacks or whichever you did first will stop working :)

bira 12-22-2001 06:29 PM

Parker Clark's zip file with the hack and the instructions can be found on post #7, as the first post of the thread states.

Lesane 12-22-2001 08:11 PM

Great hack, i luv it ;):D

Parker Clack 12-22-2001 09:21 PM

Sadie:

How does it conflict with the cost post preview hack? I mean what does it do when you use both of these together?

Parker

Sadie Frost 12-23-2001 12:58 AM

What I was talking about was the hack to make custom prefixes like "Important:" or "Sticky:".

I had done this one first, and then did the custom post prefex one. But you're editing the same section of forumdisplay.php, so when I changed forumdisplay, it made the preview first post stop working.

Quote:

Then in your forumdisplay.php file find

$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");

and replace with

$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach,preview
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin

To have both, you just need to add ",customprefix" after "preview". Then you also have to do the same thing in newthread.php

I hope that's what you were asking :)

Parker Clack 12-23-2001 11:50 AM

Sadie:

Oh, I see. Yep. That happens when you have a hack that the other person doesn't. Thanks for pointing that out.

Parker

Sadie Frost 12-23-2001 06:28 PM

Well, I just thought that for other newbies like me who don't think to check whether they've changed something in there already lol, it might save some headache :)

Gutspiller 02-07-2002 07:41 PM

Is there a way to make the popup title box stay there for as long as the mouse is over the text? I ahve IE 6 and the box only stays there for a little bit and then disappears again, and if you want to continue to read, you need to move your mouse a little bit to bring the window back up. Any way to fix this?

Any help is greatly appreciated.

Thanks!

Erwin 02-10-2002 05:56 PM

My users and mods love this! Thank you!

dost 02-10-2002 11:35 PM

Would it work on vB 2.0.3?

x28 02-16-2002 04:04 AM

Works on 2.2.2 but take your time on the install.

Can be a little tricky.

Just a little :eek:

X-Fan 02-16-2002 05:19 AM

This is perfect for a content-based site like mine. Thanks Parker!!!

X-Fan 02-16-2002 05:26 AM

Quick question - is there any way for the preview to "skip" HTML/vB Code tags?

Hold the mouse over thread links in my News forum to see what I mean...

http://x-mencomics.com/xfan/forums/f...p?s=&forumid=2

Parker Clack 02-16-2002 11:43 AM

X Fan:

This does not strip the HTML or vB code from the information that is put into the title for the URL. I don't know the coding that would be required to do this.

Gutspiller:

Unfortunately the timout for the mouse pointer is controlled by your browser. IE does the same thing with anything that you point your mouse to. Opera on the other hand leaves the box up as long as the mouse is on the link. Netscape has a timout period too.

Parker

EJMack 02-17-2002 04:43 AM

is there anyway for it to display the last post???

freakyshiat 02-25-2002 05:22 AM

Does the 'preview' field in the database just keep on getting bigger and bigger? Is it ok to empty it once old threads are deleted?

Parker Clack 02-25-2002 06:49 AM

I'm sorry. The strip code is in the hack. I am not sure if it strips the vB code or HTML. I think it is the HTML codes.

The previews will be deleted when the thread is deleted. So if you delete threads to prune your boards the previews will be deleted too. The previews are copies to the first post made in a thread and will not change in size with subsequent posts in a thread.

I am sure you could set it up to display the last post but I am not sure how to do this.

Parker

weazel 02-25-2002 04:17 PM

great hack...will be using:)

N!ck 03-02-2002 05:31 PM

why don't you just use substr() to take the first five hundred characters directly from the post rather than storing the same data twice?

Parker Clack 03-02-2002 06:44 PM

nick:

So how would you write that? I am open to any suggestion to streamline the code any.

Parker


All times are GMT. The time now is 04:46 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.01247 seconds
  • Memory Usage 1,814KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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