Example #1
0
 public function output(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     // TODO: Implement
     return;
     // setup pagemill
     $pm = new Pagemill($node->fork());
     // add settings
     $this->attributes['id'] = isset($this->attributes['id']) ? $this->attributes['id'] : 'newsarticle-' . rand(0, 9) . rand(0, 9) . rand(0, 9);
     $this->attributes['include_comments'] = isset($this->attributes['include_comments']) ? $this->attributes['include_comments'] : 'true';
     $this->attributes['include_comments'] = 'true' == $this->attributes['include_comments'];
     // Make the string into a boolean.
     $this->attributes['category'] = isset($this->attributes['category']) ? $this->attributes['category'] : '__any';
     $pm->setVariableArray($this->attributes);
     // get most recent article; use settings for category id
     $articles = new News_Article_Factory();
     $categoryid = News::GetCategoryId(true);
     $articles->setCategoryId($categoryid);
     $articles->setPubDate();
     $articles->setLimit(1);
     $article = $articles->get();
     if ($article->exists()) {
         // add some stuff to it
         $url = TYPEF_WEB_DIR . (@$this->attributes['news_page_base'] ? $this->attributes['news_page_base'] : News::GetCategoryUri($article->get('categoryid'))) . '/' . ($article->get('encodedtitle') ? $article->get('encodedtitle') : $article->get('newsid'));
         $article->set('url', $url);
         if (!trim($article->get('title'))) {
             $article->set('title', '[untitled]');
         }
         // add to template
         $pm->setVariable('article', $article);
         // included for backwards compatibility (?)
         $pm->setVariable('newsid', $article->get('newsid'));
         // update the view count for this article
         $article->incrementViews();
     }
     // @todo retrieve all the comments also
     if ($this->attributes['include_comments']) {
     }
     // output the result
     //return $pm->writeText('<pm:include template="/news/article.plug.html" />');
     $this->pluginTemplate = '/news/article.plug.html';
     parent::output($data, $stream);
 }