Forum Moderators: open
For those who just need to have all of bill's Additional Search Tools [webmasterworld.com] on every single page of WebmasterWorld. Plus I've added in the beta MSN site search. There's some neat (to me) customizing features at the bottom.
Credit to Brett_Tabke for the idea. Whoever that guy is... ;)
Here's the custom code for the "control panel > system preferences > "Custom Code Insert" top or bottom:
<iframe name="webworld" id="webworld" src="[b]http://www.example.com/ww/engines.php[/b]" width="90%" height="36" frameborder="0" style="margin-left:5%;overflow:hidden;"></iframe>
The bold part is important and will need to match the location of the file you are about to create.
This is the code you'll put into a new file on a public webserver:
[small]<html>
<head>
<style type="text/css">
<!--
form { display:inline; }
button { display:inline; }
-->
</style>
</head>
<body>
<?php
// Results in same window or new window?
// script.php?t=b for new window, or leave blank for same
if (isset($_GET['t']) && ($_GET['t']!= '')) {
if ($_GET['t'] = 'b') {
$target = "_blank";
} else {
$target = "_parent";
}
} else {
$target = "_parent";
}
// Want submit buttons?
// script.php?s=1 for buttons, or leave blank for none
if (isset($_GET['s']) && ($_GET['s']!= '')) {
if ($_GET['s'] = '1') {
$submit = '<button type="submit">←</button> ';
} else {
$submit = '';
}
} else {
$submit = '';
}
// Each variable defined here is selectable and orderable as it's own code chunk
// script.php?e=g.a for Google then AlltheWeb
$g = <<<EOF
<form method="GET" action="http://www.google.com/search" target="$target">
<input type="hidden" name="domains" value="webmasterworld.com">
<input TYPE="text" name="q" size="9" maxlength="255" value="Google WW">
<input type="hidden" name="sitesearch" value="webmasterworld.com">
$submit
</form>
EOF;
$y = <<<EOF
<form method=get action="http://search.yahoo.com/search" target="$target">
<input type="text" name="p" size="8" value="Yahoo WW">
<input type="hidden" name="fr" value="yscpb">
<input type="hidden" name="vs" id="ysvs1" value="webmasterworld.com" />
$submit
</form>
EOF;
$a = <<<EOF
<form action="http://www.alltheweb.com/search" method="get" target="$target">
<input name="q" size="11" value="AlltheWeb WW" />
<input type="hidden" name="advanced" value="1" />
<input name="cat" type="hidden" value="web" />
<input name="charset" type="hidden" value="iso-8859-1" />
<input type="hidden" name="dincl" value="webmasterworld.com" />
$submit
</form>
EOF;
$b = <<<EOF
<form method="get" action="http://www.gigablast.com/search" target="$target">
<input type="hidden" name="sc" value="0" />
<input type="hidden" name="site" value="www.webmasterworld.com" />
<input type="text" name="q" size="11" value="Gigablast WW"/>
$submit
</form>
EOF;
$m = <<<EOF
<form method="get" action="http://beta.search.msn.com/results.aspx" target="$target">
<input type="hidden" name="cp" value="1252" />
<input type="text" name="q" size="11" value="Beta MSN WW" />
<input type="hidden" name="q1" value="site:webmasterworld.com" />
$submit
</form>
EOF;
if (isset($_GET['e']) && ($_GET['e']!= '')) {
$engines_requested = $_GET['e'];
$engine_array = explode(".",$engines_requested);
// print_r($engine_array);
for ( $q=0; $q < 5; $q++ ) {
echo $$engine_array[$q];
}
} else {
echo $g.$y.$m.$a.$b;
}
?>
</body>
</html>[/small]
Default output is the five search engine's WW site search (Google, Yahoo, MSN Beta, Alltheweb, and Gigablast in that order) only but you can fully customize to your preferences by appending some variables to the SRC of the iframe.
e=y.g.a.m.b will change the order of the search engine forms. You can also trim the list if there is only really one or two you like (For example "e=g.m" will show Google and MSN Beta searches, in that order. "b" is Gigablast.)
t=b Search results open in a new window.
s=1 Adds submit buttons, if you want them.
You'll need to put a "?" after the file name and a "&" between each variable. (If you don't know what I mean, the example below does a better job of illustrating how to customize the output.)
For example, this custom code will give me first Gigablast, then Yahoo with submit buttons and results opening in a new window:
<iframe name="webworld" id="webworld" src="http://www.example.com/ww/[b]engines.php?e=b.y&t=b&s=1[/b]" width="90%" height="36" frameborder="0" style="margin-left:5%;overflow:hidden;"></iframe> Notes:
1. Wherever you host this file will have a log entry for every page load from webmasterworld with the referrer listed as the page you were viewing. If you are using "someone else's" copy, they will know what threads, etc. you've viewed at WW. I originally considered posting the URL to my copy of this script for others to use, until I noticed that I would have IP and activity logs for anyone using it. My recommendation? Host the file yourself.
2. I'm not the best PHP programmer ever. Please recommend fixes/security updates if my scripting is garbage. This script works well enough for me and I hope others can benefit from it. :D