require_once ('sitemap.inc' );
// $this -> db = & NewADOConnection( constant(‘mysql’) );
// $this -> db -> Connect( constant(”), constant(‘db95809′), constant(”), constant(”) );
define ( ‘DB_TYPE’ , ‘mysql’ ) ;
define ( ‘DB_SERVER’ , ‘internal-db.s95809.gridserver.com’ ) ;
define ( ‘DB_NAME’, ‘db95809_lettermen’ ) ;
define ( ‘DB_USERNAME’ , ‘db95809′ );
define ( ‘DB_PASSWORD’ , ‘l3tt3rmen!’ );
global $wpdb;
//if the url_limit is reached then the remaining links will be written to a new file
//google has a 50.000 link limit for a sitemap file, so this is set for compatibility
define(‘url_limit’, 50000);
//this is the character that will replace all white space from the links, if you don’t want this just put a space as the character
define(‘white_space’, ‘_’);
//if true the sitemaps are compressed, this speeds up sitemap downloading and reduces bandwidth usage
define(‘sitemap_compress’, true);
//initiate a new sitemap object
//$playerinfo = $wpdb->get_results(‘SELECT ll_schools.school, ll_sports.sport FROM `ll_schools`,`ll_conferences`, `ll_sports` WHERE ll_schools.schoolid = ll_players.school AND ll_sports.sportid = ll_players.sport AND ll_players.conference = ll_conferences.conferenceid ORDER BY LL_schools.school LIMIT 1′);
$schoolinfo = $wpdb->get_results(‘SELECT ll_schools.school, ll_schools.schoolid FROM `ll_schools` ORDER BY ll_schools.school’);
foreach($schoolinfo as $school)
{
$schoolname = strtolower($school->school);
$schoolfilename = str_replace(” “,”_”,$schoolname);
$schoolfilename = str_replace(“&”,”",$schoolfilename);
$schoolfilename = str_replace(“.”,”",$schoolfilename);
$schoolfilename = str_replace(“‘”,”",$schoolfilename);
$sitemap = new sitemap($schoolfilename,’http://www.lostlettermen.com’);
$schoolname = ucwords($school-school);
$sqlquery = ‘SELECT ll_schools.school, ll_schools.schoolid, ll_sports.sport, ll_conferences.conference, ll_players.playerid, ll_players.player_first, ll_players.player_last FROM `ll_players`,`ll_schools`,`ll_conferences`, `ll_sports` WHERE ll_schools.schoolid = ll_players.school AND ll_sports.sportid = ll_players.sport AND ll_players.conference = ll_conferences.conferenceid AND ll_schools.schoolid = ‘. $school->schoolid. ‘ ORDER BY ll_players.player_last’;
echo strtolower($schoolfilename) . ‘
‘;
//add a table from which to generate the links
$sitemap -> addtable(
$sqlquery, //sql query to extract data used to generate the links to the posts
‘http://www.lostlettermen.com/%s/%s/%s/%s_%s/p%s’,//url format, %s will be replaced with title for each record from the database
array(‘sport’,'conference’,'school’,'player_first’,'player_last’,'playerid’), //database field name that will be used to replace the “%s” in the url
‘weekly’, //page change interval can be one of these : always, hourly, daily, weekly, monthly, yearly, never
’0.5′, //importance of the pages, this is usefull if you have other tables from which to generate links and you want to them to have different importance, the scale if from 0.1 to 1
’2010-08-12′ //update date, you can enter a fixed date here using date(‘Y-m-d’) or you can specify a database field that contains the page modification date
);
//generate the sitemap
echo $sitemap -> process();
// you can email the results returned by this function or you can log them to a file
//ping search engines
$sitemap -> ping($schoolfilename);
}
?>


