PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Isaac Scott   GSM   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples of use for GoogleSiteMap
Class: GSM
Generate a site map from list of server side files
Author: By
Last change:
Date: 16 years ago
Size: 1,432 bytes
 

Contents

Class file image Download
<?php
// initialise the class
require_once 'GoogleSiteMap.php';
$gsm = new GoogleSiteMap();

/*
optional function are shown below
*/
// set the system to only look in the initial folder
// valid entries are true/false default is true
$gsm->setRecursive(false);

// makes the system ignore the file/folder passed
// valid enties can be either a single string or an
// array of strings that are either files or folders
$gsm->excludeEntry("example");
$excludes = array("GoogleSiteMap.php", "GoogleSiteMapEntry.php");
$gsm->excludeEntry($excludes);

// add a specific extension to be included when checking
// valid entries should be the extension without the dot
// both a single string or an array of strings can be passed
$gsm->addExt("xml");
$exts = array("htm", "html", "php");
$gsm->addExt($exts);

// add a specific extension to be excluded when checking
// valid entries should be the extension without the dot
// both a single string or an array of strings can be passed
$gsm->removeExt("php");
$exts = array("htm", "html", "php");
$gsm->removeExt($exts);

// takes 2 required arguments being the virtual file/folder, the modified
// time as a unix timestamp and an optional priority as a float
// between 0 and 1
$gsm->dynamicEntry("abc.html", mktime(12, 0, 0, 1, 11, 2008), 0.8);

// to output the xml, this function also outputs the correct header for xml
echo $gsm->generateXml();
?>