Sphidermap Class

Posted on Thursday, October 2nd, 2008 at 9:59 am in

A PHP class which uses Sphider’s sites and links tables to create a site map for a single site.

Returns a nested definition list (with an overall id of ’sitemap’) with each top-level section
followed by a list of pages in that section in the form:

<dl id="sitemap">
<dt><a href="#">Home</a></dt>
<dd><dl>
<dt><a href="#">Section 1</a></dt>
<dd><ul>
<li><a href="#">Page 1</a></li>
[...]
</ul><dd>
[...]
</dl></dd>
</dl>

Place within sphider includes directory.
Call in a page named sitemap.php, site-map.php, SiteMap.php or Site-Map.php

Usage:

 $sitemap = new SphiderMap;
    $output = $sitemap->sphidermap($base,$exts,$email,$toremove);
    foreach($output as $listing) {
        echo $listing;
    }

where:

$base
Base URL of site – also used to create the Home link
$exts
file extensions to be included (eg. ‘php’ etc)
$email
email address for errors
$toremove
Repetitive text to be removed from any displayed link text

Use your robots.txt file to exclude Sphider from indexing specific pages or directories.

Tested on Sphider Version 1.2.x

NOTE: The class assumes that the index page within each site section will be ‘index’+file extension
eg. http://www.mysite.com/foo/index.php

WARNING: The class will not pick up links with an _ (underscore) in a top-level filename as MySQL rejects queries that include underscore as part of a regular expression.

A sample sitemap page is included in the download.

Downloads

You might also be interested in
Tags:

WordPress CMS and Blog Themes from £19.95

Top