PHP Classes

File: sample_files/mixed.php

Recommend this page to a friend!
  Classes of ultral   Google site map generator   sample_files/mixed.php   Download  
File: sample_files/mixed.php
Role: Example script
Content type: text/plain
Description: sample
Class: Google site map generator
Generate Google site maps from arrays or MySQL
Author: By
Last change:
Date: 18 years ago
Size: 1,582 bytes
 

Contents

Class file image Download
<?php
include_once "../class/GoogleSiteMap.php";
// Create the GoogleSiteMap XML String
$map=new GoogleSiteMap();
//now we add mixed data !
//Add simple URL
$map->Add("http://www.test.com/index.php?cat=boutique&id=5");
$map->Add("http://www.test.com/index.php?cat=boutique&id=6");
//Add array of URL
$a=array("http://www.test.com/index.php?cat=boutique&id=6","http://www.test.com/index.php?cat=boutique&id=7");
$map->Add($a);
//Add associative array of URL
$a=array(
        array(
loc=>"http://www.test.com/index.php?cat=boutique&id=6"),
        array(
loc=>"http://www.test.com/index.php?cat=boutique&id=60")
    );
$map->Add($a);
//Add associative array of URL with full arguments
$a=array(
    array(
loc=>"http://www.test.com/index.php?cat=boutique&id=7",lastmod=>"",changefreq=>"always",priority=>"0.2"),
   
//Add another url with full option
    
array(loc=>"http://www.test.com/index.php?cat=boutique&id=8",lastmod=>"2006-07-11T11:39:38+02:00",changefreq=>"never",priority=>"0.9")
);
$map->Add($a);
//Add a folder to parse
$option=array(url=>"http://www.test.com/",hidden=>".htaccess,.txt,.xml",recursive=>true);
$map->Add("../sample_files",$option);
DBConnect();
$req="SELECT path as loc , freq as changefreg ,priority as priority FROM map";
$res=mysql_query($req);
$map->Add($res);
DBClose();



//close the XML String
$map->Close();
//Output the XML String
$map->View();
?>

<?php
//connect to mysql database
function DBConnect(){
   
mysql_connect('localhost','root','');
   
mysql_select_db("test_ggmap");
}
function
DBClose(){
    @
mysql_close();
}
?>