예제 #1
0
 public function feed(Request $req, Response $res)
 {
     $articles = $this->em($this->module->name('article'))->all(['limit' => $this->module->option('feedLimit')]);
     $feed = new Feed("{$this->home['name']} {$req->content->name}", $this->url->route([], $this->module->name('main'), true), "{$this->chalk->config->name}", $articles[0]->publishDate);
     foreach ($articles as $article) {
         $feed->add($article->name, $this->url($article), $this->app->date($article->publishDate), $article->description($this->module->option('extractLength')), $this->parser->parse($article->body));
     }
     return $res->xml($feed->toXml(), 'atom');
 }
예제 #2
0
 public function xml(Request $req, Response $res)
 {
     $sitemap = $this->hook->fire($this->module->name('xml'), new CoastSitemap());
     return $res->xml($sitemap->toXml());
 }