예제 #1
0
 /**
  * Build sitemap
  *
  * @param	integer	$rootPageId	Root page id
  * @param	integer	$languageId	Language id
  */
 protected function _buildSitemap($rootPageId, $languageId)
 {
     global $TSFE;
     if ($languageId !== null) {
         // Language lock enabled
         $rootPageLinkTempalte = 'sitemap-r%s-l%s-p###PAGE###.xml.gz';
         $sitemapIndexFileName = 'index-r%s-l%s.xml.gz';
         $sitemapPageFileName = 'sitemap-r%s-l%s-p%s.xml.gz';
     } else {
         $rootPageLinkTempalte = 'sitemap-r%s-p###PAGE###.xml.gz';
         $sitemapIndexFileName = 'index-r%s.xml.gz';
         $sitemapPageFileName = 'sitemap-r%s-p%3$s.xml.gz';
     }
     // Init builder
     $builder = new tx_tqseo_sitemap_builder_xml();
     $fileName = sprintf($rootPageLinkTempalte, $rootPageId, $languageId);
     $builder->indexPathTemplate = $this->_generateSitemapLinkTemplate($fileName);
     // Get list of pages
     $pageCount = $builder->pageCount();
     // Index
     $content = $builder->sitemapIndex();
     $fileName = sprintf($sitemapIndexFileName, $rootPageId, $languageId);
     $this->_writeToFile(PATH_site . '/' . $this->_sitemapDir . '/' . $fileName, $content);
     // Page
     for ($i = 0; $i < $pageCount; $i++) {
         $content = $builder->sitemap($i);
         $fileName = sprintf($sitemapPageFileName, $rootPageId, $languageId, $i);
         $this->_writeToFile(PATH_site . '/' . $this->_sitemapDir . '/' . $fileName, $content);
     }
     return true;
 }
예제 #2
0
 /**
  * Build sitemap
  *
  * @return	string
  */
 protected function _build()
 {
     $page = t3lib_div::_GP('page');
     $sitemapBuilder = new tx_tqseo_sitemap_builder_xml();
     if (empty($page) || $page == 'index') {
         return $sitemapBuilder->sitemapIndex();
     } else {
         return $sitemapBuilder->sitemap($page);
     }
 }