Hacking Sphider to Weigh the Heading Tags · 19 April 2006 by Julian
These are the instructions on how to add heading weightings (the h1 to h6 tags found in web pages, just like Google does) to the Sphider Search Engine .
Once installed this will allow you to apply a weighting to the various heading tags found in web pages when indexed. (cause you’re using the heading tags right?!? ;-))
Warning! Not for Amateurs
Before you begin make sure you take the necessary precautions and backup your files & when you break it, remember that itâ??s not my fault; youâ??re the one to blame.
O.K. here we go…
Replace the following functions:
in spiderfuncs.php
& in spider.php
Add the following to the following files:
settings/config.php => at the very end:
// Relative weight of a word in heading tags
// ............................................................... added by Julz // ............................................................... added by Julz
$heading_weights = array ('h1' => 9, 'h2' => 8, 'h3' => 7, 'h4' => 6, 'h5' => 4, 'h6' => 2);
admin/configset.php => inside the “if (isset($Submit))” right after the other weights settings:
// ............................................................... added by Julz // ............................................................... added by Julz
fwrite($fhandle, "\n\n// Relative weight of a word in heading tags\n");
fwrite($fhandle,"$"."heading_weights = array ('h1' => " . $_h1_weight . ", 'h2' => " . $_h2_weight . ", 'h3' => " . $_h3_weight . ", 'h4' => " . $_h4_weight . ", 'h5' => " . $_h5_weight . ", 'h6' => " . $_h6_weight . ");");
admin/configset.php => just before the submit button:
<!-- // ................................. added by Julz -->
<?php
for ($i = 1; $i <= 6; $i++) { ?>
<tr>
<td class="left1"><input name="_<?php echo 'h' . $i;?>_weight" type="text" id="<?php echo 'h' . $i;?>_weight" size="5" maxlength="2" value="<?php echo $heading_weights['h' . $i];?>">
</td>
<td> Relative weight of a word in <?php echo 'h' . $i;?> tags</td>
</tr>
<?php } ?>
<!-- // ................................. added by Julz -->
