Exemple #1
0
 /**
  * 首页
  */
 public function index()
 {
     // 搜索参数
     $get = $this->input->get(NULL, TRUE);
     $get = isset($get['rewrite']) ? dr_rewrite_decode($get['rewrite']) : $get;
     $get['keyword'] = str_replace(array('%', ' '), array('', '%'), $get['keyword']);
     unset($get['c'], $get['m'], $get['page']);
     $where = '';
     if ($get) {
         foreach ($get as $name => $v) {
             $where .= $name . '=' . $v . ' ';
         }
     }
     $this->template->assign(array('get' => $get, 'where' => $where, 'params' => $get, 'urlrule' => dr_space_search_url($get, 'page', '[page]'), 'meta_title' => $this->space['title'], 'meta_keywords' => $this->space['keywords'], 'meta_description' => $this->space['description']));
     $this->template->display('index.html');
 }
 protected function _index()
 {
     // 搜索参数
     $get = $this->input->get(NULL, TRUE);
     $get = isset($get['rewrite']) ? dr_rewrite_decode($get['rewrite']) : $get;
     $_GET['page'] = max(1, (int) $get['page']);
     $get['keyword'] = str_replace(array('%', ' '), array('', '%'), $get['keyword']);
     unset($get['c'], $get['m'], $get['page']);
     $where = '';
     if ($get) {
         $field = $this->get_cache('member', 'field');
         $space = $this->get_cache('member', 'spacefield');
         foreach ($get as $name => $v) {
             if (isset($space[$name]) && $space[$name]['fieldtype'] == 'Linkage') {
                 // 组合空间字段的联动菜单
                 $link = dr_linkage($space[$name]['setting']['option']['linkage'], $v);
                 if ($link) {
                     if ($link['child']) {
                         $where .= 'IN_' . $name . '=' . $link['childids'] . ' ';
                     } else {
                         $where .= $name . '=' . $link['ii'] . ' ';
                     }
                 }
             } elseif (isset($field[$name]) && $field[$name]['fieldtype'] == 'Linkage') {
                 // 组合会员字段的联动菜单
                 $link = dr_linkage($field[$name]['setting']['option']['linkage'], $v);
                 if ($link) {
                     if ($link['child']) {
                         $where .= 'IN_' . $name . '=' . $link['childids'] . ' ';
                     } else {
                         $where .= $name . '=' . $link['ii'] . ' ';
                     }
                 }
             } else {
                 $where .= $name . '=' . $v . ' ';
             }
         }
     }
     $this->template->assign(array('get' => $get, 'where' => $where, 'params' => $get, 'keyword' => $get['keyword'], 'urlrule' => dr_space_search_url($get, 'page', '[page]'), 'meta_title' => $this->space['title'], 'meta_keywords' => $this->space['keywords'], 'meta_description' => $this->space['description']));
     $this->template->display('index.html');
 }