コード例 #1
0
ファイル: Templatetags.php プロジェクト: hbasria/pjango
 function render($contxt, $stream)
 {
     $contentType = ContentType::get_for_model('Post', 'Pjango\\Contrib\\Post');
     $slug = false;
     if (isset($this->args[0])) {
         $slug = $this->clearQuotes($this->args[0]);
     }
     $q = Doctrine_Query::create()->from('PostCategory c')->leftJoin('c.Translation t')->where('c.site_id = ? AND c.taxonomy = ?', array(SITE_ID, Post::TYPE_POST));
     if ($slug) {
         $category = PostCategory::findBySlug($slug, Post::TYPE_POST);
         if ($category) {
             $q->andWhere('c.lft >= ? AND c.rgt <= ?', array($category->lft, $category->rgt));
         }
     }
     $results = $q->execute();
     //print_r($results->toArray());
     $htmlContent = '<div class="section post">';
     if ($pageLayout->show_title) {
         $htmlContent .= '<h2>' . __($pageLayout->title) . '</h2>';
     }
     $htmlContent .= '<div class="box-content">';
     //$htmlContent .= '<ul>'.implode('', $htmlItems).'</ul>';
     $htmlContent .= '</div>';
     $htmlContent .= '<div class="buttons"><div class="right"><a href="' . pjango_ini_get('SITE_URL') . '/post/">' . __('All Posts') . ' &raquo;</a></div></div>';
     $htmlContent .= '<div style="clear:both;"></div>';
     $htmlContent .= '</div>';
     //$stream->write($htmlContent);
 }