<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/murraysb/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from '_permalinks'
  list($_permalinksRecords, $_permalinksMetaData) = getRecords(array(
    'tableName'   => '_permalinks',
    'orderBy'     => '',   // use default database order
    'loadUploads' => false,
    'allowSearch' => false,
  ));

?>
<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<'.'?xml version="1.0" encoding="UTF-8"?>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

    <?php foreach ($_permalinksRecords as $record): ?>
   <url>

    <loc>http://<?php echo $_SERVER['HTTP_HOST']; ?><?php echo $record['_link'] ?></loc>
    
    <lastmod><?php echo date('Y-m-d', strtotime($record['updatedDate'])) ?></lastmod>
    
    <?php if ($record['old']): ?><changefreq>never</changefreq>  
    <?php else: ?><changefreq>weekly</changefreq>  
    <?php endif ?> 
    
    <priority>0.5</priority>

   </url>
    <?php endforeach ?>

</urlset> 