/** * 添加采集规则 */ public function add() { if (IS_POST) { $data = array('title' => I('post.title'), 'cate' => I('post.cate')); //列表页规则 $listRuleArr = array('listurl' => I('post.listurl'), 'listobj' => $_POST['listobj'], 'listattr' => I('post.listattr')); $data['listrule'] = json_encode($listRuleArr); //内容页规则 $pageRuleArr = array(); $cate = I('post.cate'); $cateArr = explode(',', $cate); $mid = $cateArr[1]; $ModelField = DD('ModelField'); $fieldlist = $ModelField->selFieldByMid($mid); foreach ($fieldlist as $key => $f) { if (isset($_POST[$f['fieldname'] . '_rule'])) { $pageRuleArr[$f['fieldname']] = $_POST[$f['fieldname'] . '_rule']; } } $data['pagerule'] = json_encode($pageRuleArr); $PlgCollection = D('PlgCollection'); $b = $PlgCollection->addData($data); if ($b !== false) { echo 'OK'; } else { echo 'ERROR'; } } else { $Category = DD('Category'); $result = $Category->select(); $Category_arr = \Org\Helper\Unlimitedclass::cateresult($result); $this->assign('category', $Category_arr); $this->display(); } }
public function allcate() { $Category = DD('Category'); $catelist = $Category->select(); $Category_arr = \Org\Helper\Unlimitedclass::cateresult($catelist); $this->assign('Category_arr', $Category_arr); $this->display('Widget:allcate'); }
private function _catecommon() { /* 模型 */ $Model = DD('Model'); $Modellist = $Model->select(); $this->assign('Modellist', $Modellist); /* 分类 */ $Category = DD('Category'); $result = $Category->select(); $Category_arr = \Org\Helper\Unlimitedclass::cateresult($result); $this->assign('category', $Category_arr); /* 模板 */ $dir = 'Template/Site/' . C('SITE_THEME') . '/Content/Content'; $listtmpl = array(); $catetmpl = array(); $newstmpl = array(); $pagetmpl = array(); $files = getfils($dir); foreach ($files as $f) { if (strpos(strtolower($f), 'category') === 0) { $f_arr = explode('.', $f); $catetmpl[] = $f_arr[0]; continue; } if (strpos(strtolower($f), 'list') === 0) { $f_arr = explode('.', $f); $listtmpl[] = $f_arr[0]; continue; } if (strpos(strtolower($f), 'news') === 0) { $f_arr = explode('.', $f); $newstmpl[] = $f_arr[0]; continue; } if (strpos(strtolower($f), 'page') === 0) { $f_arr = explode('.', $f); $pagetmpl[] = $f_arr[0]; continue; } } $this->assign('tmpl', array('catetmpl' => $catetmpl, 'listtmpl' => $listtmpl, 'newstmpl' => $newstmpl, 'pagetmpl' => $pagetmpl)); }
public static function getcate() { $Category = DD('Category'); $result = $Category->select(); $Category_arr = \Org\Helper\Unlimitedclass::cateresult($result); }