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)
-   -   Add Search/Sort/Order in thread view (https://vborg.vbsupport.ru/showthread.php?t=39947)

Smoothie 06-19-2002 08:30 PM

Depending on the number of posts in each thread, I saw queries as hig as 89, but just on the showthreads. On every other page it was normal. My normal amount of queries on showthreads is about 26-28. After I took the hack out, showthreads page went back to normal.

bad_madman 06-19-2002 10:06 PM

The problem is found and cleared.
Update follows...

@Smoothie:
Many many thanks for your note :classic: :cool:


edit:
Download was actualized.

Smoothie 06-20-2002 12:30 AM

The new version is in the first post?

bad_madman 06-20-2002 12:46 AM

yep

Smoothie 06-20-2002 01:15 AM

how many queries are you seeing with the new version?

bad_madman 06-20-2002 01:21 AM

With installed new version of the hack it is only still 2 queries more now... :classic:

But this isn't avoidable. If you still liked to have a query less, then copy the contents of template "showthread_adds" into the template "showthread" (replace $threadview_adds with that) and remove the template "showthread_adds". You still then remove the line
Code:

eval("\$threadview_adds=\"".gettemplate("showthread_adds")."\";");
in file showthread.php.
That's all. It is then only ONE query. But this everything for a query less ? ;) ;)

Smoothie 06-20-2002 05:17 AM

bad_madman,

thanks for the update. I'll install and let ya know how it goes.

Smoothie 06-20-2002 06:05 AM

Nice! Works great! Thanks. :)

Velocd 06-21-2002 02:17 AM

Great hack, but the only problem I have found is that the string-search option doesn't work at all! I can type a specific word in somebody's post and hit the submit button, but all it does is refresh the page. Anybody else getting the search option to work? Which is basically the reason I need this hack ;)

Smoothie 06-21-2002 02:21 AM

It does however highlight the word in red.

Velocd 06-21-2002 03:26 AM

My search is bugged then, it doesn't highlight nor find :(

Attached is a picture, incase anybody is wondering, of what this hack looks like (except it doesn't come with my template modifications ;))

Velocd 06-21-2002 03:40 AM

Sorry for the double post, though it does work! I just rechecked it and the search words are in red. This hack is totally awesome bad_badman, and should be a definate nomination for hack of the month. If it were implemented on these forums it would make searching within huge threads so much easier! We just need FireFly to look at this...

BigJohnson 06-21-2002 09:14 AM

Well i am getting a problem. I upgraded not doing the first post ove rbut just adding and editing the post that i asked for. Just to add what i need to update. i don't no if you told me the wrong thing to update but i did a test on my forums. In one post i have several posts with the word STUFF in it and i searched that word and then i get only one highlighted word stuff. Thats it. All the other words are not highlighted at all. Plus if i search for a word not in the post it wont give me that error message that the update is all about.

BigJohnson 06-21-2002 09:17 AM

ok never mind it works. But it is wierd. It doesnt show the word stuff in the last post. i dont no why it is doing that but that is the only word it does it for. Wierd. Also i am still not getting any error screen. What is wrong witht that?

And also one of my templates is red so that is a problem. Is there any way we can use a replacement variable for this hack? So i can then change the replace ment variable for the HIGHLIGHTED word colors? That owuld be great because every style on my boar dhas its on replacement variable.

Boofo 06-21-2002 09:22 AM

I am getting 2 black boxes (1 on either side of the not found window when it displays). Has anyone else run into this problem?

BigJohnson 06-21-2002 09:24 AM

I dont get the error screen at all. It is wierd. i just geta refreshed page.

Boofo 06-21-2002 09:24 AM

It also will only refesh the page if it doesn't find the word it is looking for. Is there a way to have it tell you that it can't find the word you are looking for?

Quote:

Originally posted by Smoothie
It does however highlight the word in red.

BigJohnson 06-21-2002 09:29 AM

Well that was the whole point of the new updated version in. read throught the thread it is on page 3. There is no error screen and there is suppose to be one.

bad_madman 06-21-2002 12:14 PM

Quote:

Originally posted by Boofo
I am getting 2 black boxes (1 on either side of the not found window when it displays). Has anyone else run into this problem?
Your original postbit template is very changed. You also have an unusual but nice design :) You must adapt the template showthread_adds_notfound to your postbit template. You then don't get the black boxes any more.

bad_madman 06-21-2002 04:55 PM

Quote:

Originally posted by BigJohnson
...Also i am still not getting any error screen. What is wrong witht that?...
The error screen only comes, if this sort result (not the search result!!) doesn't give any posts back.
Quote:

Originally posted by BigJohnson
...And also one of my templates is red so that is a problem. Is there any way we can use a replacement variable for this hack? So i can then change the replace ment variable for the HIGHLIGHTED word colors? That owuld be great because every style on my boar dhas its on replacement variable....
This is a little more complicated. I have a fast solution here. This also more simply works certainly... :rolleyes:

- Make your replacements:
</myhighlight> is replaced by </font></i></b>
<myhighlight is replaced by <b><i><font color="red"

- Search in showthread.php for:
if (isset($highlight) and $highlight!="search") {$src[string]="$highlight";}

- and replace with:
if (isset($highlight)) {$src[string]="$highlight"; $myhighlight=1;}

- Search in admin/functions.php for:
PHP Code:

    //highlight words for search engine
    
if (isset($highlight) && $highlight != '') {
        if ((isset(
$postid) and $postid==$post[postid]) or !isset($postid)) {
            
reset($replacewords);
            while (list(
$key,$val)=each($replacewords)) {
            
$post['message']=preg_replace("#(^| |\n|\r|\t|\]|>|\")(".$val.")(([\.,]+[ $\n\r\t])|$|\"|<|\[| |\n|\r|\t)#si""\\1<highlight>\\2</highlight>\\3"$post['message']);
            }
        }
    } 

and replace with:
Code:

        global $myhighlight;
        //highlight words for search engine
        if (isset($highlight) && $highlight != '') {
                if ((isset($postid) and $postid==$post[postid]) or !isset($postid)) {
                        reset($replacewords);
                        while (list($key,$val)=each($replacewords)) {
                        if ($myhighlight) {$highl1="<myhighlight>";$highl2="</myhighlight>";} else {$highl1="<highlight>";$highl2="</highlight>";}
                        $post['message']=preg_replace("/(^| |\n|\r|\t|\]|>|\")(".$val.")(([\.,]+[ $\n\r\t])|$|\"|<|\[| |\n|\r|\t)/si", "\\1$highl1\\2$highl2\\3", $post['message']);
                        }
                }
        }

That's all ??!

Boofo 06-21-2002 05:42 PM

I just added the above code to my board and I get an error on this line every time I do a search for a specific word now.

Code:

            $post['message']=preg_replace("/(^| |\n|\r|\t|]|>|\")(".$val.")(([.,]+[ $\n\r\t])|$|\"|<|[| |\n|\r|\t)/si", "\1$highl1\2$highl2\3", $post['message']);
The error I get is:

Code:

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Warning: Compilation failed: missing terminating ] for character class at offset 57 in /home/virtual/site3/fst/var/www/html/forum/admin/functions.php on line 358

Any ideas how I can fix this, please? :)

BigJohnson 06-21-2002 06:58 PM

Well i am sorry but i am sorta lost at the replacements part. What do i exactly do. I have a code to find insert. Lol. I am new with replacements because i havent used them that much. Thanks for the quick reply though.

Boofo 06-22-2002 12:53 AM

bad_madman,

Any ideas yet why I am getting the error I wrote about a couple of posts back?

bad_madman 06-22-2002 01:07 AM

Quote:

Originally posted by Boofo
bad_madman,

Any ideas yet why I am getting the error I wrote about a couple of posts back?

Ouh sorry.
The code from my post was wrong.
Having been missing a couple of things there.
Replace the code in the file admin/functions.php with the new code in this post.

Boofo 06-22-2002 01:23 AM

Ok, that fixed the error I was getting, but now if I search for a word that is not in any messages, it just redraws the screen instead of giving me the GO BACK box. And the highlighted word is in italics too. I like it like that but it might be a good idea to make that an option. :)

Quote:

Originally posted by bad_madman
Ouh sorry.
The code from my post was wrong.
Having been missing a couple of things there.
Replace the code in the file admin/functions.php with the new code in this post.


bad_madman 06-22-2002 02:35 AM

Quote:

Originally posted by Boofo
Ok, that fixed the error I was getting, but now if I search for a word that is not in any messages, it just redraws the screen instead of giving me the GO BACK box. And the highlighted word is in italics too. I like it like that but it might be a good idea to make that an option. :)
Ok. You have persuaded me... *fgg
I plan another one couple of additional search options.
- Show only posts in which the search string was found.
- Show a message (with go back ;)), if the search string wasn't found.

Boofo 06-22-2002 02:39 AM

You are the man! I will be anxiously waiting and wanting this one! :):):)

Quote:

Originally posted by bad_madman

Ok. You have persuaded me... *fgg
I plan another one couple of additional search options.
- Show only posts in which the search string was found.
- Show a message (with go back ;)), if the search string wasn't found.


Velocd 06-22-2002 02:59 AM

Same here ;)

Smoothie 06-22-2002 04:26 AM

me too

BigJohnson 06-22-2002 08:01 AM

Quote:

Originally posted by BigJohnson
Well i am sorry but i am sorta lost at the replacements part. What do i exactly do. I have a code to find insert. Lol. I am new with replacements because i havent used them that much. Thanks for the quick reply though.
Can you please help me with this.

Edgar 06-22-2002 09:20 AM

I get a few erros as soon I uploaded my modified showthread.php file, can anybody help me?


Database error in vBulletin 2.2.6:

Invalid SQL:
SELECT post.postid FROM post
WHERE post.threadid='3351' AND post.visible=1 ORDER BY LIMIT 0,15

mysql error: You have an error in your SQL syntax near 'LIMIT 0,15
' at line 3

mysql error number: 1064

Date: Saturday 22nd of June 2002 06:11:46 AM
Script: http://www.avalancheonline.net/forum...&threadid=3351
Referer: http://www.avalancheonline.org/forum...p?s=&forumid=3

bad_madman 06-22-2002 11:29 AM

Quote:

Originally posted by Edgar
...I get a few erros as soon I uploaded my modified showthread.php file, can anybody help me?...
Something seems to be missing there. Check the place still time. In the file showthread.php must be at this place:
Code:

$getpostids=$DB_site->query("
        SELECT post.postid FROM post
        WHERE post.threadid='$threadid' AND post.visible=1$threadadds
        ORDER BY $osofin $postorder LIMIT ".($limitlower-1).",$perpage
");


bad_madman 06-22-2002 11:35 AM

Quote:

Originally posted by BigJohnson
Can you please help me with this.
Go to the vB admin CP area.
1st replacement:
- Click there on Replacements -> Add.
- Code to find: <myhighlight
- Code to insert: <b><i><font color="red"

2nd replacement:
- Click there on Replacements -> Add.
- Code to find: </myhighlight>
- Code to insert: </font></i></b>

Edgar 06-22-2002 01:05 PM

Ok, I found it, my showthread file was a little messed up and the quick reply box interfered somehow, I readded all the hacks in it and it seems to be working fine now.

Great hack madman and thanks!
Cheers.

BigJohnson 06-22-2002 07:58 PM

OK your thing worked great for the different templates. Thank you so much. You are the best.

bad_madman 06-24-2002 09:16 PM

New version out: 1.20

Updates
- Search in Thread
&nbsp; &raquo; Show only posts in which the search string was found (v1.20)
&nbsp; &raquo; Own replacement for highlighted words possible (v1.20)
&nbsp; &raquo; String search in words

Screenshots:
Screenshots in the first post.

Download:
The latest version is in the first post of this thread.

Boofo 06-24-2002 10:00 PM

Is there any update instruction if we have it installed already? :) You know how bad my template had to be redone. :)

Quote:

Originally posted by bad_madman
[B]New version out: 1.20


bad_madman 06-24-2002 11:20 PM

Ok, I changed the download file again. The update instruction are contained in the download archive now :) ... run sqltodos.php and then select "Click here for an update installation from v1.10"...

Quote:

Originally posted by Boofo
Is there any update instruction if we have it installed already? :) You know how bad my template had to be redone. :)

bad_madman 06-27-2002 01:29 PM

Somebody had complained that at every search the views counter one is increased :surprised: :nervous: This can be changed (is recommendable) :classic:

Search in showthread.php for:
Code:

if ($noshutdownfunc) {
  $DB_site->query("UPDATE thread SET views=views+1 WHERE threadid='$threadid'");
} else {
  $shutdownqueries[]="UPDATE LOW_PRIORITY thread SET views=views+1 WHERE threadid='$threadid'";
}

and replace with:
Code:

if ($ownsearch!=1) {
  if ($noshutdownfunc) {
    $DB_site->query("UPDATE thread SET views=views+1 WHERE threadid='$threadid'");
  } else {
    $shutdownqueries[]="UPDATE LOW_PRIORITY thread SET views=views+1 WHERE threadid='$threadid'";
  }
}

that's all

edit:
wrong code

Birdie501 07-11-2002 04:42 PM

Hi, nice hack!!

i installed the hack that shows the number of posts and direct link in that thread! If you search the thread and the result is shown the numbers change and start again with 1.
Is it possible to keep the original numbers?

So if a post is the third post in this thread (post #3), this number will also be shown in the search result?
Otherwise it is a little bit confusing.

Also how can i get back to the thread after searching? Because after the search there is no button where i can reset the search?

Hope you understand what i mean, is a little bit difficult for me to explain in english :)
Thanks


All times are GMT. The time now is 08:39 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
  • Page Generation 0.02322 seconds
  • Memory Usage 1,852KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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