Пример #1
0
foreach ((array) $this->_catalog as $key => $row) {
    ?>
          <?php 
    if ($row['parent_id'] == 0) {
        ?>
          <dd>
            <h3><a href="<?php 
        echo $this->createUrl('post/index', array('catalog' => $row['catalog_name_alias']));
        ?>
"><?php 
        echo $row['catalog_name'];
        ?>
</a></h3>
            <ul>
              <?php 
        foreach ((array) Catalog::lite($row['id']) as $key => $val) {
            ?>
              <li><a href="<?php 
            echo $this->_navLink($val);
            ?>
"><?php 
            echo $val['catalog_name'];
            ?>
</a></li>
              <?php 
        }
        ?>
            </ul>
          </dd>
          <?php 
    }
Пример #2
0
 /**
  * 浏览详细内容
  */
 public function actionShow($id)
 {
     $bagecmsShow = Post::model()->findByPk(intval($id));
     if (false == $bagecmsShow) {
         throw new CHttpException(404, '内容不存在');
     }
     //更新浏览次数
     $bagecmsShow->updateCounters(array('view_count' => 1), 'id=:id', array('id' => $id));
     //seo信息
     $this->_seoTitle = empty($bagecmsShow->seo_title) ? $bagecmsShow->title . ' - ' . $this->_conf['site_name'] : $bagecmsShow->seo_title;
     $this->_seoKeywords = empty($bagecmsShow->seo_keywords) ? $this->_seoKeywords : $bagecmsShow->seo_keywords;
     $this->_seoDescription = empty($bagecmsShow->seo_description) ? $this->_seoDescription : $bagecmsShow->seo_description;
     $catalogArr = Catalog::item($bagecmsShow->catalog_id, $this->_catalog);
     if ($bagecmsShow->template) {
         $tpl = $bagecmsShow->template;
     } elseif ($catalogArr['template_show']) {
         $tpl = $catalogArr['template_show'];
     } else {
         $tpl = 'show_post';
     }
     //自定义数据
     $attrVal = AttrVal::model()->findAll(array('condition' => 'post_id=:postId', 'with' => 'attr', 'params' => array('postId' => $bagecmsShow->id)));
     $tplVar = array('bagecmsShow' => $bagecmsShow, 'attrVal' => $attrVal, 'catalogArr' => $catalogArr, 'catalogChild' => Catalog::lite(intval($bagecmsShow->catalog_id)));
     $this->render($tpl, $tplVar);
 }