Welcome! Log In Create A New Profile

Advanced

How to add search form to external page...

Posted by Tim Mousel 
How to add search form to external page...
December 15, 2008 07:18AM
Hi,

My search results didn't find this solution so I thought I'd post it here. If you want to show your search form in a page in a different directory than Sphider do the following:

Here is the assumed directory structure:

/sphider/
custom.php

In custom.php, add the following:

<?php
$include_dir = "./sphider/include";
include ("$include_dir/commonfuncs.php"winking smiley;

$include_dir = "./sphider/include";
$template_dir = "../sphider/templates";
$settings_dir = "./sphider/settings";
$language_dir = "./sphider/languages";

require_once("$settings_dir/database.php"winking smiley;
require_once("$language_dir/en-language.php"winking smiley;
require_once("$include_dir/searchfuncs.php"winking smiley;
require_once("$include_dir/categoryfuncs.php"winking smiley;

include "$settings_dir/conf.php";
include "$template_dir/$template/header.html";
include "$language_dir/$language-language.php";
?>
<form action="./sphider/search.php" method="get">
<table>
<tr>
<td><div align="left">
<input type="text" name="query" id="query" size="40" value="<?php print quote_replace($query);?>" action="./sphider/include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500" />
</div></td>
<td><input type="submit" value="<?php print $sph_messages['Search']?>" />
<input type="hidden" name="search" value="1" /></td>
</tr>
</table>
</form>



Open commonfuncs.php and change the following:

$includes = array('./include', 'include', '../include');


TO:

$includes = array('./include', 'include', '../include', './sphider/include');


That's it. Hope that helps!

Tim Mousel
Five Star Review Script - www.Review-Script.com
Sorry, only registered users may post in this forum.

Click here to login