PDA

View Full Version : Module: Super Search II


58sniper
07-22-2004, 10:15 PM
Here ya go - a module that allows you to search vB, and NINE other search engines - all from one module.

Create a new template, adv_portal_supersearch2, and paste this into it:


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat smallfont" style="font-weight: bold;"><a style="float: $stylevar[right]" href="#" onclick="return toggle_collapse('forumhome_supersearch2');"><img src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_randomtopic].gif" width="13" height="12" border="0" alt="Collapse/Expand" /></a>$vba_options[portal_blockbullet] Super Search II</td>
</tr>
<tr id="collapseobj_forumhome_supersearch2" style="$vbcollapse[collapseobj_forumhome_randomtopic]">
<td class="alt1 smallfont">
<script type="text/javascript" language="JavaScript">
function startSearch(){
searchString = document.searchForm.searchText.value;
switch (document.searchForm.whichEngine.value) {
case "altavista":
finalSearchString = "http://www.altavista.com/web/results?q=" + searchString;
break
case "yahoo":
finalSearchString = "http://search.yahoo.com/search?p=" + searchString;
break
case "excite":
finalSearchString = "http://msxml.excite.com/info.xcite/search/web/" + searchString;
break
case "hotbot":
finalSearchString = "http://www.hotbot.com/?MT=" + searchString;
break
case "infoseek":
finalSearchString = "http://www.infoseek.com/Titles?qt=" + searchString;
break
case "lycos":
finalSearchString = "http://www.lycos.com/cgi-bin/pursuit?query=" + searchString;
break
case "aolnetfind":
finalSearchString = "http://netfind.aol.com/aolcom/search?query=" + searchString;
break
case "google":
finalSearchString = "http://www.google.com/search?q=" + searchString;
break
case "mysearch":
finalSearchString = "http://mysearch.myway.com/jsp/GGmain.jsp?searchfor=" + searchString;
break
case "netscape":
finalSearchString = "http://search.netscape.com/ns/search?query=" + searchString;
break
case "vb":
finalSearchString = "";
document.searchForm.action = "$vboptions[bburl]/search.php";

document.searchForm.method = "post";
document.searchForm.query.value = document.searchForm.searchText.value;
document.searchForm.submit();
return true;
break
default:
finalSearchString = "";
}
document.location = finalSearchString;
return true;
}
</script>
<form name="searchForm" method="post" action="">
Search for: <input name="searchText" type="text" /> <b>@</b>
<input type="hidden" name="do" value="process" />
<input type="hidden" name="showposts" value="0" />
<input type="hidden" name="query" />
<select name="whichEngine">
<option value="vb">$vboptions[bbtitle]</option>
<option value="altavista">Altavista</option>
<option value="yahoo">Yahoo!</option>
<option value="excite">Excite</option>
<option value="hotbot">Hotbot</option>
<option value="infoseek">Infoseek</option>
<option value="lycos">Lycos</option>
<option value="aolnetfind">AOL Netfind</option>
<option value="google">Google</option>
<option value="mysearch">MySearch</option>
</select>
<input type="button" value="Search" onclick="startSearch();" />
</form>
</td>
</tr>
</table>
<br />


In AdminCP, create a new module:
name: "Super Search II"
template: "supersearch2"
active: yes
column: left

demo (http://www.efhs84.com/) on the left, at the bottom.

I can certainly add some more search engines, but you get the idea....

This script will almost certainly blow your XHTML validation. If/when I get some time, I'll work on that (shouldn't take anything more than exporting the javascript to an external .js file & some testing).

Let me know what you think.

kvtech
07-25-2004, 01:12 AM
Good work, installed!

Thanks

Our Sponsors
 

apokalupsis
07-25-2004, 01:09 PM
I see only Google enabled in your demo. It doesn't search all engines.

58sniper
07-25-2004, 01:40 PM
I see only Google enabled in your demo. It doesn't search all engines.
You ARE looking at the very bottom module, "Super Search II", right? The one above that, "Super Search" is the one with only vB and Google.

Our Sponsors
 

Realist
07-25-2004, 04:14 PM
Works well and installed, nice job but..........

When peeps install the template remember to edit this line:

document.searchForm.action = "http://www.efhs84.com/forum/search.php";

To there forums path.

Laters

Dark_Wizard
07-25-2004, 04:22 PM
Works well and installed, nice job but..........

When peeps install the template remember to edit this line:

document.searchForm.action = "http://www.efhs84.com/forum/search.php";

To there forums path.

Laters

Just change it to this:

document.searchForm.action = "$vboptions[bburl]/search.php";



Nice job!

58sniper
07-25-2004, 04:25 PM
Just change it to this:

document.searchForm.action = "$vboptions[bburl]/search.php";



Nice job!

Hmm... dunno how I let THAT slip in there. I've updated the original code.

Thanks for pointing it out!

bigassguy
07-28-2004, 05:52 AM
Great Job!

Lizard King
07-28-2004, 07:11 PM
Installed nice job dude.

I have another question.When we push Search button.It directly searches in the same window.Can we force it to open the search results in another window ?

58sniper
07-28-2004, 11:16 PM
Installed nice job dude.

I have another question.When we push Search button.It directly searches in the same window.Can we force it to open the search results in another window ?Sure. In my code, replace

document.location = finalSearchString;withwindow.open(finalSearchString);

Natch
07-28-2004, 11:59 PM
And one small thing you can do towards validation - try replacing<script type="text/javascript" language="JavaScript">with<script type="text/javascript"> - that will make a bit of a difference

58sniper
07-29-2004, 08:08 AM
Actually, using the language parameter validates as XHTML

Tony
09-19-2004, 12:55 PM
Anyone else get a Runtime error when they use the Yahoo search?

Line: 315
Error: 'SymRealWinOpen' is undefined

58sniper
09-19-2004, 09:11 PM
I just tested mine @ efhs84.com, and it worked fine. Does your error happen when you choose Yahoo, or when you submit?

TTG
09-23-2004, 07:03 PM
Installed and works well ... thanks 58sniper

Roms
11-08-2004, 09:39 PM
Thanks, great addition. :)

Roms
11-08-2004, 09:42 PM
If you want the "search" button to look like your other buttons change the following in "adv_portal_supersearch2":

Find:

<input type="button" value="Search" onclick="startSearch();" />

Replace with:
<input type="button" value="Go" class="button" onclick="startSearch();" />

Lizard King
11-15-2004, 08:19 PM
In Mozilla and Firefox I have no problem using this module but if you use IE then you will face problems. It gives an error :
Line : 836
Character : 3
'document.searchForm.searchText.value', null or not an item.

You can check it from www.ayyas.com

My template code is

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat smallfont" style="font-weight: bold;"><a style="float: $stylevar[right]" href="#" onclick="return toggle_collapse('forumhome_supersearch2');"><img src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_randomtopic].gif" width="13" height="12" border="0" alt="Collapse/Expand" /></a>$vba_options[portal_blockbullet] Super Search II</td>
</tr>
<tr id="collapseobj_forumhome_supersearch2" style="$vbcollapse[collapseobj_forumhome_randomtopic]">
<td class="alt1 smallfont">
<script type="text/javascript" language="JavaScript">
function startSearch(){
searchString = document.searchForm.searchText.value;
switch (document.searchForm.whichEngine.value) {
case "google":
finalSearchString = "http://www.google.com/search?q=" + searchString;
break
case "sozluk":
finalSearchString = "http://sozluk.sourtimes.org/show.asp?t=" + searchString;
break
case "vb":
finalSearchString = "";
document.searchForm.action = "$vboptions[bburl]/search.php";

document.searchForm.method = "post";
document.searchForm.query.value = document.searchForm.searchText.value;
document.searchForm.submit();
return true;
break
default:
finalSearchString = "";
}
window.open(finalSearchString);
return true;
}
</script>
<form name="searchForm" method="post" action="">
Search for: <input name="searchText" type="text" /> <b>@</b>
<input type="hidden" name="do" value="process" />
<input type="hidden" name="showposts" value="0" />
<input type="hidden" name="query" />
<select name="whichEngine">
<option value="vb">$vboptions[bbtitle]</option>
<option value="google">Google</option>
<option value="sozluk">Ek$i Sozluk</option>
</select>
<input type="button" value="Ara" class="button" onclick="startSearch();" />
</form>
</td>
</tr>
</table>
<br />

ncangler
03-08-2005, 03:46 PM
Just installed SuperSearch II and it is SUPER! Thanks 58sniper!
:cool:

mfarmerhi
06-06-2005, 05:06 PM
Anyone else noticing that the script causes your browser to reload, the very first time you use the search?

AFTER it's reloaded the page, you can perform further searches without the script reloading the page.

But the first time forces the page to reload.

You can test this by refreshing the page. You'll notice your browser will tell you that it needs to "resend the information" in order to reload the page, despite the fact that all your doing is reloading the front page and NOT sending any info...

I re-examined this module addition Sniper, because the original code (http://www.vbadvanced.com/forum/showthread.php?t=1805) you suggested (and use on your site) for the original "SuperSearch" was not working correctly -- it doubles what ever search term you use, when searching Google (e.g. searching for "test" results in search listings for "test test").

I'm really hoping to find a seach module that allows users to search either Google or your own site (via Vbulletin), but need one that doesn't require re-loading the page before it will work; nor alters the search term by doubling it...

arian88
06-07-2005, 08:25 AM
TNHX :P

mfarmerhi
06-14-2005, 05:24 PM
Curious: Is no one else noticing the Google search error I posted above...

Or does no body care that this module doesn't actually search the specific term you input?

ncangler
06-14-2005, 06:02 PM
I've noticed that I have to click the "Go" button as opposed to hitting enter, but the search works fine.

mfarmerhi
06-15-2005, 11:19 PM
Use it to search Google. Enter one word, then tell me what it actually searched.

See? It duplicates whatever word you entered (e.g. if you search "cars" on Google, it returns searches for "cars cars")

ncangler
06-16-2005, 11:03 PM
I tried it on my site and it just came up as "cars".

Prodimysterio
07-15-2005, 10:57 AM
Can someone provide a step by step for this? I tried to create the supersearch2.php file with the code provided, and uploaded it, then attempted to create the module, but it never shows up on my CMPS even though it is enabled and even though all users have permission to view it. Any help would be most apprecaited because I am totally lost here.

Prodimysterio
07-15-2005, 11:35 AM
Nevermind. I finally figured it out thanks to help from theMusicMan. Thanks!

:)

Judge Ruckus
07-15-2005, 10:50 PM
I am working on this now for CMPS v2.0 RC2 and I am doing pretty good so far but one change I would like to make is the text field.

What do I change or add to make the text field shorter so that the box will not be as wide.

ForYou
10-30-2005, 04:25 PM
Hello ,

When I search about Arabic Word there is no output and i will see Uicode font , not Arabic Font ,

is there help for this problem ,

Regards