예제 #1
0
파일: Cms.php 프로젝트: huang81820/mycms
function hits2art($cat_id = 0, $num = 10, $is_all = 1, $order = '')
{
    $top_cat_id = top_parent($cat_id);
    $top_cat = CMS_M('category')->where('category_id=' . $top_cat_id)->find();
    $table = CMS_M('cm_table')->where('table_id=' . $top_cat['module_id'])->find();
    $table_name = $table['table_name'];
    $table_m = CMS_M($table_name);
    $table_m_pk = $table_m->getPk();
    $resultAllCat = array();
    $articles = array();
    $originCat = CMS_M('category')->where('category_id=' . $cat_id)->find();
    $resultAllCat[] = $originCat;
    if ($is_all == 1) {
        get_child_cat($cat_id, $resultAllCat);
    }
    $ids = array();
    $where = array();
    foreach ($resultAllCat as $row) {
        $ids[] = $row['category_id'];
    }
    $where['cat_id'] = array('in', $ids);
    $order = $order == '' ? 'hits DESC,' . $table_name . '_sort ASC' : $order;
    import('ORG.Util.Page');
    $count = $table_m->where($where)->order($order)->count();
    $Page = new Page($count, $num);
    $show = $Page->show();
    $list = $table_m->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
    foreach ($list as $key => $val) {
        $where2 = array();
        $where2['category_id'] = $val['cat_id'];
        $catInfo = CMS_M('category')->where($where2)->find();
        $list[$key]['cat_info'] = $catInfo;
    }
    $articles = array();
    $articles['lists'] = $list;
    $articles['page'] = $show;
    return $list;
}
        </div>
    </div>
    <!--结束头部-->
	
	<div id="main_contact">
		<div id="main_contact_con">
			<img src="<?php 
echo $list_thumb;
?>
" />
			<div id="contact_con_left">
				<div id="side_nav_wrap">
					<div id="side_nav_con">
						<img id="about_tit" src="__PUBLIC__/statics/default/images/case_tit.png" />
						<?php 
$subcat = sub_cat(top_parent(cat_id()));
?>
						<ul id="side_nav2" cat_id="<?php 
echo cat_id();
?>
" >
						<?php 
foreach ($subcat as $subcatRow) {
    ?>
							<li cat_id="<?php 
    echo $subcatRow[category_id];
    ?>
" ><a href="<?php 
    echo CAT_PATH;
    ?>
/<?php 
예제 #3
0
 public function module2actions()
 {
     $category_id = I('category_id');
     $top_parent_id = top_parent($category_id);
     $cateInfo = CMS_M('category')->where('category_id=' . $top_parent_id)->find();
     $module_id = $cateInfo['module_id'];
     $table = CMS_M('cm_table')->where('table_id=' . $module_id)->find();
     $table_name = $table['table_name'];
     $con_m = CMS_M($table_name);
     $pk = $con_m->getPk();
     //AAA(ucfirst($table_name).'/'.ucfirst($table_name).'_list');
     //$dir = U(ucfirst($table_name).'/'.ucfirst($table_name).'_list',array('category_id'=>$category_id,'module_id'=>$module_id));
     $this->redirect(ucfirst($table_name) . '/' . ucfirst($table_name) . '_list', array('category_id' => $category_id, 'module_id' => $module_id));
 }