示例#1
0
 public function listing($file, $page)
 {
     $siteconfigs = $this->siteconfigs;
     $categorys = $this->categorys;
     $category = $this->category;
     $cid = $category['cid'];
     $seo_title = $category['seo_title'] ? $category['seo_title'] : $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = $category['seo_keywords'];
     $seo_description = $category['seo_description'];
     $elasticid = elasticid($cid);
     //分页初始化
     $page = max($page, 1);
     $urlrule = $this->category['listurl'];
     $urlrules = explode('|', $urlrule);
     $urlrule = WWW_PATH . $urlrules[0] . '|' . WWW_PATH . $urlrules[1];
     $GLOBALS['catdir'] = $this->category['catdir'];
     $GLOBALS['categorydir'] = $this->category['parentdir'];
     if ($category['child']) {
         $_template = $category['category_template'];
     } else {
         $_template = $category['list_template'];
     }
     if (empty($_template)) {
         $_template = TPLID . ':list';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $model_r = get_cache('model_content', 'model');
     $master_table = $model_r[$category['modelid']]['master_table'];
     if ($category['type'] == 1) {
         $db = load_class('db');
         $r = $db->get_one($master_table, array('cid' => $cid));
         if ($r) {
             extract($r, EXTR_SKIP);
             if ($attr_table = $model_r[$category['modelid']]['attr_table']) {
                 $r = $db->get_one($attr_table, array('id' => $id));
                 extract($r, EXTR_SKIP);
             }
         }
     }
     $sub_categorys = sub_categorys($cid);
     ob_start();
     include T('content', $_template, $project_css);
     return $this->write($file);
 }
示例#2
0
        }
        ?>
            </div>
        </div>
    </div>
</div>
<?php 
        $n++;
    }
}
?>

    <div class="container">
    <div class="row">
        <?php 
$sub_categorys = sub_categorys(3);
?>
            <?php 
$n = 1;
if (is_array($sub_categorys)) {
    foreach ($sub_categorys as $cid => $cat) {
        ?>
         <div class="col-xs-6" >
           <h4><a href="<?php 
        echo $cat['url'];
        ?>
"><?php 
        echo $cat['name'];
        ?>
</a></h4>
            <div class="row">
示例#3
0
 /**
  * 栏目列表
  */
 public function listing()
 {
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
     //站点信息
     $siteconfigs = $this->siteconfigs;
     //栏目信息
     $categorys = get_cache('category', 'content');
     $category = get_cache('category_' . $cid, 'content');
     if (empty($category)) {
         MSG('栏目不存在');
     }
     //分页初始化
     $page = max(intval($GLOBALS['page']), 1);
     //分页规则
     $urlrule = '';
     if ($category['child']) {
         $_template = $category['category_template'];
     } else {
         $_template = $category['list_template'];
     }
     if (empty($_template)) {
         $_template = TPLID . ':list';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $seo_title = $category['seo_title'] ? $category['seo_title'] : $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = $category['seo_keywords'];
     $seo_description = $category['seo_description'];
     $elasticid = elasticid($cid);
     $model_r = get_cache('model_content', 'model');
     $master_table = $model_r[$category['modelid']]['master_table'];
     if ($category['type'] == 1) {
         $r = $this->db->get_one($master_table, array('cid' => $cid));
         if ($r) {
             extract($r, EXTR_SKIP);
             if ($attr_table = $model_r[$category['modelid']]['attr_table']) {
                 $r = $this->db->get_one($attr_table, array('id' => $id));
                 extract($r, EXTR_SKIP);
             }
         }
     }
     $sub_categorys = sub_categorys($elasticid);
     include T('content', $_template, $project_css);
 }