Beginner Q RE Sphider search script

Hi there,

I’m currently re-building an information heavy website and would like to implement a search tool to make it easier for people to find what they’re looking for.

I’ve been playing with the Sphider search tools and have - more or less - successfully added this to a demo version of my previous project here:

Portrait and Wedding Photography from the West Midlands - by Joseph Peter Singh

(It’s totally superfluous to this site but it was somewhere I could practice with it on!)

I had a few teething problems - the search box code from Sphider had extra options and radio buttons coded in php which I basically just cut despite not really knowing what the code was for, but it still seems to work OK! :shifty:

So, it’s gone from this:

<center>
<table cellpadding="5" cellspacing="1" class="searchBox">
<tr>
	<td align="center">

	<form action="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="include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500">	
</div> 
<td>
<input type="submit" value="<?php print $sph_messages['Search']?>">
</td></tr></table>

	   
<?php  if ($adv==1 || $advanced_search==1) {
?>
	<table width = "100%">
	<tr>
		<td width="40%"><input type="radio" name="type" value="and" <?php print $type=='and'?'checked':''?>><?php print $sph_messages['andSearch']?></td>
		<td><input type="radio" name="type" value="or" <?php print $_REQUEST['type']=='or'?'checked':''?>><?php print $sph_messages['orSearch']?></td></tr>
	<tr>
		<td><input type="radio" name="type" value="phrase" <?php print $_REQUEST['type']=='phrase'?'checked':''?>><?php print $sph_messages['phraseSearch']?></td>

		<td><?php print $sph_messages['show']?>
			<select name='results'>
		      <option <?php  if ($results_per_page==10) echo "selected";?>>10</option>
			  <option <?php  if ($results_per_page==20) echo "selected";?>>20</option>
		      <option <?php  if ($results_per_page==50) echo "selected";?>>50</option>
		      <option <?php  if ($results_per_page==100) echo "selected";?>>100</option>
			</select>

				
	  		<?php print $sph_messages['resultsPerPage']?>   
	  	</td>
	</tr>
	</table>
<?php }?>


	
<?php if ($catid<>0){?>     
	<center><b><?php print $sph_messages['Search']?></b>: <input type="radio" name="category" value="<?php print $catid?>"><?php print $sph_messages['Only in category']?> "<?php print $tpl_['category'][0]['category']?>'" <input type="radio" name="category" value="-1" checked><?php print $sph_messages['All sites']?></center>

<?php  }?>
	<input type="hidden" name="search" value="1"> 
	</form>
		<?php if ($has_categories && $search==1 && $show_categories){?> 
		<a href="search.php"><?php print $sph_messages['Categories']?></a>
		<?php  }?>	   
	</td>

</tr>
</table>
</center>

To this:

				<center>
<table cellpadding="5" cellspacing="1" class="searchBox">
<tr>
	<td align="center">

	<form action="search.php" method="get">

<table><tr><td>
	<div align="left"> 
<input type="text" name="query" id="query" size="40" value="" action="include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500"/>	
</div> 
<td>
<input type="submit" value="Search"/>
</td></tr></table>

	   
<?php  if ($adv==1 || $advanced_search==1) {
?>
	
<?php }?>


	
	<input type="hidden" name="search" value="1"/> 
	</form>
			   
	</td>

</tr>
</table>
</center>

Please let me know if I’ve deleted anything vital!

I was then getting a ‘Division by zero’ warning when searching from the front page, but used an ‘@’ on the appropriate line of code so as not to display this.

My final issue is with the results page. I’ve managed to get the results to display in a template of the normal site page (bar some extra tweaking) but the Sphider php adds a new search dialogue and white space at the top of the page. How would I go about removing that/moving the search dialogue into the main content area?

I know this is all dead cheeky, but any pointers would be gratefully received! I’m afraid my learning style is to start drowning and then call for help! :injured: