/** * This action handles rewrites from nginx for URLs like: * /sitemap.html * /sitemap-1.html * /sitemap-2.html * etc. * * @param \Difra\Param\AnyInt $page * @throws \Difra\View\HttpError */ public function htmlAction(\Difra\Param\AnyInt $page = null) { $this->cache = self::CACHE_TTL; if (!($html = \Difra\Libs\XML\Sitemap::getHTML($page))) { throw new \Difra\View\HttpError(404); } $this->outputType = 'text/html'; $this->output = $html; }
public static function addSitemapHTML() { $html = \Difra\Libs\XML\Sitemap::getXMLforHTML(); if (!$html) { return; } $controller = \Difra\Envi\Action::getController(); $sitemapNode = $controller->realRoot->appendChild($controller->xml->createElement('sitemap')); $sitemapNode->setAttribute('html', $html); }