Пример #1
0
 public function actionSiteMap()
 {
     $siteMap = new \Feedify\Writer();
     $siteMap->addItems($this->getAllPages());
     $siteMap->addItems(array(array('url' => 'http://' . $_SERVER['SERVER_NAME'] . \Staq\Util::getControllerUrl($this, 'archive'))));
     $siteMap->addItems($this->getAllArticles());
     $siteMap->addAttributeFormatter('url', function ($article) {
         if (isset($article->id)) {
             $path = $article->id;
             if ($path == 'index') {
                 $path = '';
             }
             return 'http://' . $_SERVER['SERVER_NAME'] . \Staq\Util::getPublicUrl($path);
         }
         if (isset($article['url'])) {
             return $article['url'];
         }
     });
     $siteMap->addAttribute('date');
     $siteMap->output(\Feedify\Writer::SITEMAP_FORMAT);
     return TRUE;
 }