예제 #1
0
 public function chageSite()
 {
     if ($_SESSION['siteid'] = $_REQUEST['siteid']) {
         $res = CMS_M('website')->where('website_id=' . get_site_id())->find();
         $_SESSION['tplPath'] = 'Templates/' . trim($res['weburl']);
         echo '1';
         exit;
     } else {
         echo '0';
         exit;
     }
 }
예제 #2
0
 public function Category_edit()
 {
     //获取表格主建
     $pk = M($this->cmTableName)->getPk();
     $pkVal = $_REQUEST[$pk];
     $this->getTpls();
     //根据主键获取编辑的表单并分配
     $res = M($this->cmTableName)->where($pk . '=' . $pkVal)->find();
     D($this->cmTableName)->form->_getEditorForm($res);
     $this->assign('form', D($this->cmTableName)->form->editInfo);
     $this->assign('res', $res);
     $res = CMS_M('category')->where('siteid=' . get_site_id())->select();
     $res = $this->getTree($res, $pid = 0);
     $this->assign('cat_list', $res);
     $this->display($this->cmTableName . '/edit');
 }
예제 #3
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;
}
예제 #4
0
 public function search()
 {
     $module_id = $_REQUEST['module_id'];
     $search_key = $_REQUEST['search_key'];
     $table = CMS_M('cm_table')->where('table_id=' . $module_id)->find();
     $table_name = $table['table_name'];
     $con_m = CMS_M($table_name);
     $res = $con_m->where('title LIKE "%' . $search_key . '%"')->select();
     $this->assign('result', $res);
     $this->showTpl('search_pro');
 }