vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Add-On Releases - Live Search 1.0 (AJAX) (https://vborg.vbsupport.ru/showthread.php?t=154694)

coderphp 08-07-2007 10:00 PM

Live Search 1.0 (AJAX)
 
About the hack
==============

The hack adds a quick live search form to your forum's at any place you want it,
results are to be shown exactly under the search field as you type (by ajax)

Supported browsers
==============

IE6, IE7, FF2, Opera 9

Demo
====================

http://www.montadaphp.net
right under the logo :)

How to Install
==============

1- Add the following code to the end of ur "headinclude" template:
Code:

<script type="text/javascript">
/***********************************************
* Drop Down/ Overlapping Content- ? Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display="block"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}
var xmlHttp3
function showHint(word)
{
document.getElementById('search_results').innerHTML = '<p></p><p></p><p align="center" class="smallfont"><img src="images/progress.gif" />Searching..</p>';
    xmlHttp3=GetXmlHttpObject3()
    if (xmlHttp3==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }
    var url="ajax_search.php"
    url=url+"?query="+word
    xmlHttp3.onreadystatechange=stateChanged3
    xmlHttp3.open("GET",url,true)
    xmlHttp3.send(null)
}

function stateChanged3()
{
    if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
    {
        document.getElementById("search_results"). innerHTML='<div align="left"><a href="#" onClick="overlayclose(\'search_results\'); return false">x</a></div>'+xmlHttp3.responseText;
return overlay(this, 'search_results')
    }
}

function GetXmlHttpObject3()
{
    var objXMLHttp3=null
    if (window.XMLHttpRequest)
    {
        objXMLHttp3=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp3=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp3
}
</script>

2- Add the following code wherever you want the search field to appear, for me i added to the "header" template exactly under the logo:
Code:

<form action="search.php?do=process" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
Live search <input type="text" name="query" size="25" class="header_search_field" onkeyup="showHint(this.value)" />
</form>
<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none;overflow:auto; height:200px">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>

3- Upload the contents of folder "Upload" to ur froum's home directory.

and u r done

If u like the hack please dont forget to click INSTALL :)

beduino 08-08-2007 07:01 PM

Interesting!
Tks 4 share
Beduino

JD45 08-08-2007 07:12 PM

Could this be integrated in to the existing search field instead of creating another one?

coderphp 08-08-2007 07:18 PM

Quote:

Originally Posted by JD45 (Post 1312976)
Could this be integrated in to the existing search field instead of creating another one?

of course it could

How?
do steps 1 and 3
then
add the onclick event to the search field:
Code:

onkeyup="showHint(this.value)"
then, after the field, add the hidden div where the search results appears:
Code:

<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>


ahmedeldeep 08-08-2007 07:27 PM

Goog work mahmoud

coderphp 08-08-2007 07:28 PM

Quote:

Originally Posted by ahmedeldeep (Post 1312993)
Goog work mahmoud

thanx ahmed for ur support ;)

dethfire 08-08-2007 07:57 PM

how server intensive is this? could it be abused?

coderphp 08-08-2007 08:01 PM

Quote:

Originally Posted by dethfire (Post 1313017)
how server intensive is this? could it be abused?

there is no limitation for the search frequency, as the code is to be executed on every key press

for me i didnt suffer from any abuse of usage
u can decide ur self if it is suitable for u or not :)

iogames 08-08-2007 09:04 PM

Queries?

cairocairo 08-08-2007 10:01 PM

Goog work mahmoud

TheBlackPoet 08-08-2007 10:33 PM

this is very nice... it is efficient.. and it gives my site that...... RIGHT NOW feel.. for a microwave age....

installed!

4x4 Mecca 08-08-2007 11:04 PM

I still see some foreign language when I am changing search terms... How do I fix that?

4x4 Mecca 08-08-2007 11:45 PM

Ok, I found it in the first edit, and changed it to "Searching..."

asw 08-08-2007 11:55 PM

And I'm glad you did! I've been looking and looking on how to remove the foreign language as well.
Many thanks! Great Hack!

4x4 Mecca 08-09-2007 12:04 AM

Right now all my search result text is white for some reason.. I made the background navy to see the text, where would I change the text color?

coderphp 08-09-2007 12:45 AM

Quote:

Originally Posted by iogames (Post 1313066)
Queries?

Only one query which searches the database

coderphp 08-09-2007 12:46 AM

Quote:

Originally Posted by cairocairo (Post 1313105)
Goog work mahmoud

thanx

coderphp 08-09-2007 12:46 AM

Quote:

Originally Posted by TheBlackPoet (Post 1313122)
this is very nice... it is efficient.. and it gives my site that...... RIGHT NOW feel.. for a microwave age....

installed!

thank u

coderphp 08-09-2007 12:47 AM

Quote:

Originally Posted by 4x4 Mecca (Post 1313140)
I still see some foreign language when I am changing search terms... How do I fix that?

Quote:

Originally Posted by 4x4 Mecca (Post 1313165)
Ok, I found it in the first edit, and changed it to "Searching..."

fixed in the original post... sorry for the mess

coderphp 08-09-2007 12:50 AM

Quote:

Originally Posted by asw (Post 1313173)
And I'm glad you did! I've been looking and looking on how to remove the foreign language as well.
Many thanks! Great Hack!

many thanx to u

Quote:

Originally Posted by 4x4 Mecca (Post 1313181)
Right now all my search result text is white for some reason.. I made the background navy to see the text, where would I change the text color?

the search results text is taking the color of ur "smallfont" class..
if it is white it will be white too

dbirosel 08-09-2007 04:03 AM

Will this ever work for the Opera Browser? Subscribed.

JD45 08-09-2007 04:10 AM

Quote:

Originally Posted by coderphp (Post 1312983)
of course it could

How?
do steps 1 and 3
then
add the onclick event to the search field:
Code:

onkeyup="showHint(this.value)"
then, after the field, add the hidden div where the search results appears:
Code:

<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>


Thank you much!

FreshFroot 08-09-2007 04:25 AM

i'll try this out, looks great.

TheBlackPoet 08-09-2007 04:35 AM

Quote:

Originally Posted by 4x4 Mecca (Post 1313181)
Right now all my search result text is white for some reason.. I made the background navy to see the text, where would I change the text color?


if you want to change the text code... its probably in the Main CSS

<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>


that worked for me....

I was looking at the css.. and if i have time tomorrow (if the coder dont mind).. i want to see if i can make the background with a little less opacity (transparent).... that'll be cool...

Brew 08-09-2007 06:13 AM

There is a bug in the ajax_search.php file

You've forgotten to add code in there for table prefixes.

In my setup I used vb_ for my tables of vBulletin so this mod gives DB errors.

I included an image showing the DB error below.

I hard coded my table prefix to the file but you'll need to use the variable to fix it.

It's working BTW.

Good job!

apdcanari 08-09-2007 06:20 AM

Good hack :)

/images/progress.gif (empty)

Overflow

<form action="search.php?do=process" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<strong>Live Search</strong> <input type="text" name="query" size="25" class="search" onkeyup="showHint(this.value)" />
</form>
<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none; overflow:auto; height:200px">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>

Brew 08-09-2007 06:29 AM

Quote:

Originally Posted by apdcanari (Post 1313324)
Good hack :)

/images/progress.gif (empty)

Overflow

<form action="search.php?do=process" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<strong>Live Search</strong> <input type="text" name="query" size="25" class="search" onkeyup="showHint(this.value)" />
</form>
<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none; overflow:auto; height:200px">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>

Thanks!

That looks much better :)

rainyleaves 08-09-2007 07:26 AM

Great mod.
But you have forgotten to add code in there for table prefixes.

Quote:

Database error in vBulletin 3.6.8:

Invalid SQL:
SELECT * FROM `thread` WHERE `title` LIKE '%24%' AND `thread`.`forumid` NOT IN (0 );

MySQL Error : Table '*****.thread' doesn't exist
Error Number : 1146
Date : Thursday, August 9th 2007 @ 05:23:39 PM
Script : http://*****.***/forums/ajax_search.php?query=24
Referrer : http://*****.***/forums/newthread.php?do=newthread&f=6
IP Address : *******
Username : *****
Classname : vB_Database
Please help...
Thanks.. :)

StrifeX 08-09-2007 07:41 AM

I'm having the same problem, i get a database error saying there is a problem with the table prefix...

FReeSTER 08-09-2007 07:55 AM

Im getting a data base error. :confused:

Code:

Database error in vBulletin 3.6.5:

Invalid SQL:
SELECT * FROM `thread` WHERE `title` LIKE '%c%' AND `thread`.`forumid` NOT IN (0 ,186);

MySQL Error  : Table 'satpro_web.thread' doesn't exist
Error Number : 1146
Date        : Thursday, August 9th 2007 @ 06:03:07 AM
Script      : http://www.satprolatino.tv/ajax_search.php?query=c
Referrer    : http://www.satprolatino.tv/foro.php
IP Address  : **.242.***.7
Username    : El Intocable
Classname    : vb_database


FReeSTER 08-09-2007 08:01 AM

Damn, do this work for vb3.6.5 ?:o

coderphp 08-09-2007 08:25 AM

Quote:

Originally Posted by dbirosel (Post 1313265)
Will this ever work for the Opera Browser? Subscribed.

yes tested on Opera 9.x and it is working

coderphp 08-09-2007 08:27 AM

Quote:

Originally Posted by FreshFroot (Post 1313275)
i'll try this out, looks great.

thanx

coderphp 08-09-2007 08:28 AM

Quote:

Originally Posted by TheBlackPoet (Post 1313279)
if you want to change the text code... its probably in the Main CSS

<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>


that worked for me....

I was looking at the css.. and if i have time tomorrow (if the coder dont mind).. i want to see if i can make the background with a little less opacity (transparent).... that'll be cool...

thank u for ur support
of course u can add what ever code modification to the mod ... also u can put it here for the other members

coderphp 08-09-2007 08:30 AM

Quote:

Originally Posted by Brew (Post 1313319)
There is a bug in the ajax_search.php file

You've forgotten to add code in there for table prefixes.

In my setup I used vb_ for my tables of vBulletin so this mod gives DB errors.

I included an image showing the DB error below.

I hard coded my table prefix to the file but you'll need to use the variable to fix it.

It's working BTW.

Good job!

fixed.. please re-download the attached file :)

coderphp 08-09-2007 08:34 AM

Quote:

Originally Posted by apdcanari (Post 1313324)
Good hack :)

/images/progress.gif (empty)

Overflow

<form action="search.php?do=process" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<strong>Live Search</strong> <input type="text" name="query" size="25" class="search" onkeyup="showHint(this.value)" />
</form>
<div id="search_results" class="smallfont" style="position:absolute; border: 2px solid orange; color:blue; background-color: white; width: 300px; padding: 8px; display:none; overflow:auto; height:200px">
<div align="left"><a href="#" onClick="overlayclose('search_results'); return false">x</a></div>
</div>

thanx that looks better...

if u dont mind added to the original file

coderphp 08-09-2007 08:36 AM

Quote:

Originally Posted by rainyleaves (Post 1313353)
Great mod.
But you have forgotten to add code in there for table prefixes.



Please help...
Thanks.. :)

Quote:

Originally Posted by StrifeX (Post 1313362)
I'm having the same problem, i get a database error saying there is a problem with the table prefix...

fixed :)

coderphp 08-09-2007 08:37 AM

Quote:

Originally Posted by El Intocable (Post 1313373)
Damn, do this work for vb3.6.5 ?:o

of course it is working

rainyleaves 08-09-2007 08:43 AM

Re-downloaded and re-install.
Same error...

Quote:

Database error in vBulletin 3.6.8:

Invalid SQL:
SELECT * FROM `thread` WHERE `title` LIKE '%24%' AND `thread`.`forumid` NOT IN (0 );

MySQL Error : Table '*****.thread' doesn't exist
Error Number : 1146
Date : Thursday, August 9th 2007 @ 06:40:48 PM
Script : http://*******/forums/ajax_search.php?query=24
Referrer : http://******/forums/index.php
IP Address : ************
Username : ********
Classname : vB_Database
Thanks.. :)

coderphp 08-09-2007 10:04 AM

Quote:

Originally Posted by rainyleaves (Post 1313398)
Re-downloaded and re-install.
Same error...



Thanks.. :)

updated now
please redownload


All times are GMT. The time now is 05:23 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.01510 seconds
  • Memory Usage 1,856KB
  • 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
  • (24)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