Пример #1
0
 /**
  * Create sitemap index
  *
  * @return	string
  */
 public function sitemapIndex()
 {
     global $TSFE;
     $pageLimit = 10000;
     if (isset($this->tsSetup['pageLimit']) && $this->tsSetup['pageLimit'] != '') {
         $pageLimit = (int) $this->tsSetup['pageLimit'];
     }
     $sitemaps = array();
     $pageItems = count($this->sitemapPages);
     $pageCount = ceil($pageItems / $pageLimit);
     $linkConf = array('parameter' => tx_tqseo_tools::getCurrentPid() . ',' . $TSFE->type, 'additionalParams' => '', 'useCacheHash' => 1);
     for ($i = 0; $i < $pageCount; $i++) {
         if ($this->indexPathTemplate) {
             $link = str_replace('###PAGE###', $i, $this->indexPathTemplate);
             $sitemaps[] = $link;
         } else {
             $linkConf['additionalParams'] = '&page=' . ($i + 1);
             $sitemaps[] = tx_tqseo_tools::fullUrl($TSFE->cObj->typoLink_URL($linkConf));
         }
     }
     $ret = '<?xml version="1.0" encoding="UTF-8"?>';
     $ret .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
     $ret .= ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
     foreach ($sitemaps as $sitemapPage) {
         $ret .= '<sitemap><loc>' . htmlspecialchars($sitemapPage) . '</loc></sitemap>';
     }
     $ret .= '</sitemapindex>';
     // Call hook
     tx_tqseo_tools::callHook('sitemap-xml-index-output', $this, $ret);
     return $ret;
 }