getConfig('site_start'); $startid = (isset($startid)) ? $startid : 0; # $format [ sp | txt | ror ] # Which format of sitemap to use: # - sp <- Sitemap Protocol used by Google # - txt <- text file with list of URLs # TODO - ror <- Resource Of Resources # Default: sp $format = (isset($format) && ($format != 'ror')) ? $format : 'sp'; # $priority [ str ] # Name of TV which sets the relative priority of # the document. If there is no such TV, this # parameter will not be used. # Default: sitemap_priority $priority = (isset($priority)) ? $priority : 'sitemap_priority'; # $changefreq [ str ] # Name of TV which sets the change frequency. If # there is no such TV this parameter will not be # used. # Default: sitemap_changefreq $changefreq = (isset($changefreq)) ? $changefreq : 'sitemap_changefreq'; # $excludeTemplates [ str ] # Documents based on which templates should not be # included in the sitemap. Comma separated list # with names of templates. # Default: empty $excludeTemplates = (isset($excludeTemplates)) ? $excludeTemplates : array(); # $excludeTV [ str ] # Name of TV (boolean type) which sets document # exclusion form sitemap. If there is no such TV # this parameter will not be used. # Default: 'sitemap_exclude' $excludeTV = (isset($excludeTV)) ? $excludeTV : 'sitemap_exclude'; # $xsl [ str ] # URL to the XSL style sheet # or # $xsl [ int ] # doc ID of the XSL style sheet $xsl = (isset($xsl)) ? $xsl : ''; if (is_numeric($xsl)) { $xsl = $modx->makeUrl($xsl); } # $excludeWeblinks [ bool ] # Should weblinks be excluded? # You may not want to include links to external sites in your sitemap, # and Google gives warnings about multiple redirects to pages # within your site. # Default: false $excludeWeblinks = (isset($excludeWeblinks)) ? $excludeWeblinks : false; /* End parameters ----------------------------------------------- */ # get list of documents # --------------------------------------------- $docs = getDocs($modx,$startid,$priority,$changefreq,$excludeTV); # filter out documents by template or TV # --------------------------------------------- // get all templates $select = $modx->db->select("id, templatename", $modx->getFullTableName('site_templates')); while ($query = $modx->db->getRow($select)) { $allTemplates[$query['id']] = $query['templatename']; } $remainingTemplates = $allTemplates; // get templates to exclude, and remove them from the all templates list if (!empty ($excludeTemplates)) { $excludeTemplates = explode(",", $excludeTemplates); // Loop through each template we want to exclude foreach ($excludeTemplates as $template) { $template = trim($template); // If it's numeric, assume it's an ID, and remove directly from the $allTemplates array if (is_numeric($template) && isset($remainingTemplates[$template])) { unset($remainingTemplates[$template]); } else if (trim($template) && in_array($template, $remainingTemplates)) { // If it's text, and not empty, assume it's a template name unset($remainingTemplates[array_search($template, $remainingTemplates)]); } } // end foreach } $output= array(); // filter out documents which shouldn't be included foreach ($docs as $doc) { if (isset($remainingTemplates[$doc['template']]) && !$doc[$excludeTV] && $doc['published'] && $doc['template']!=0 && $doc['searchable']) { if (!$excludeWeblinks || ($excludeWeblinks && $doc['type'] != 'reference')) { $output[] = $doc; } } } $docs = $output; unset ($output, $allTemplates, $excludeTemplates); # build sitemap in specified format # --------------------------------------------- switch ($format) { // Next case added in version 1.0.4 case 'ulli': // UL List $output .= "