Beispiel #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;
 }
Beispiel #2
0
 public static function getModelControllerUrl($model, $action = 'view', $parameters = [], $absoluteURL = false)
 {
     $controllerName = \Staq\Util::getStackQuery($model);
     $controller = \Staq::Ctrl($controllerName);
     if ($controller) {
         $parameters = $controller->getRouteAttributes($model);
     }
     $uri = \Staq::App()->getUri($controller, $action, $parameters);
     return \Staq\Util::getPublicUrl($uri, $absoluteURL);
 }