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);
 }
Example #2
0
File: view.php Project: ssrsfs/blg
$settings = Typeframe::CurrentPage()->settings();
$typef_app_dir = Typeframe::CurrentPage()->uri();
// get tag
$tag = urldecode(Typeframe::CurrentPage()->pathInfo());
if ('' == $tag) {
    $tag = @$_REQUEST['tag'];
}
// validate tag
if (!$tag) {
    Typeframe::Redirect('Invalid tag specified.', $typef_app_dir, 1);
    return;
}
// add tag to template
$pm->setVariable('tag', $tag);
// create news article factory;
// limit to a particular category
// limit to a particular tag
$articles = new News_Article_Factory();
$articles->setCategoryId(@$settings['categoryid']);
$articles->setTag($tag);
// add articles to template
$pm->setVariable('news', $articles);
// get comment types
$comment_types = CommentType::DAOFactory();
$comment_types->select()->order('name');
// add comment types to template
$pm->setVariable('comment_types', $comment_types);
// add page title and header to template
$title = News::GetTitle();
$pm->setVariable('page_title', $title);
$pm->setVariable('page_header', $title);