<?php /** * File will be called whenever sitemap.xml is requested from the server * * Will return all pages which are not hidden and accessible by user. * * @author Perfler Dominik <*****@*****.**> * @copyright 2014-2015 Perfler Dominik * @license MIT */ header("Content-Type: text/xml"); // This is a xml file $xml = new SimpleXMLElement('<xml/>'); // Create a new xml file foreach (Lightwork::Pages() as $page) { if (!$page['hidden']) { if (0 >= $page['minrank'] && 0 <= $page['maxrank']) { if ($page['key'] == 'index') { // Rename index to nothing $page['key'] = ''; } $url = $xml->addChild('url'); // Add the "url" child $url->addChild('loc', URL . urlencode($page['key'])); // Add the "loc" child to the "url" and assign the page to its value $url->addChild('priority', '1.000'); // Set the priority to 1.000 (hardcoded for now) } } }