$sqlcount = "SELECT count(*) from " . DB::table('content') . " AS info WHERE info.isdelete=0 " . $wheresql; $pagetotal = DB::result_first($sqlcount); $sql = "SELECT info.info_id, info.info_cateid, info.title, cate.title AS cate_title from " . DB::table('content') . " AS info LEFT JOIN " . DB::table('content_cate') . " AS cate ON info.info_cateid = cate.info_cateid WHERE info.isdelete=0 " . $wheresql . " ORDER BY info.info_id DESC LIMIT " . $pagestart . "," . $numPerPage; $page_array = DB::fetch_all($sql); include template('admin/info/info'); break; default: //DEBUG 查询并返回信息链接 $page_array = array(); $sqlcount = $sql = $wheresql = $title_keyword = $pageNum = $numPerPage = ''; $title_keyword = isset($_REQUEST['title_keyword']) ? $_REQUEST['title_keyword'] : ''; $pageNum = isset($_REQUEST['pageNum']) ? $_REQUEST['pageNum'] : 1; $numPerPage = isset($_REQUEST['numPerPage']) ? $_REQUEST['numPerPage'] : 15; $pagestart = ($pageNum - 1) * $numPerPage; if ($title_keyword) { $wheresql .= " AND info.title LIKE '%" . $title_keyword . "%'"; } $sqlcount = "SELECT count(*) from " . DB::table('content') . " AS info WHERE info.isdelete=0 " . $wheresql; $pagetotal = DB::result_first($sqlcount); $sql = "SELECT info.info_id, info.info_cateid, info.title, cate.title AS cate_title from " . DB::table('content') . " AS info LEFT JOIN " . DB::table('content_cate') . " AS cate ON info.info_cateid = cate.info_cateid WHERE info.isdelete=0 " . $wheresql . " ORDER BY info.info_id DESC LIMIT " . $pagestart . "," . $numPerPage; $page_array = DB::fetch_all($sql); //DEBUG 获取分类树形菜单 START $cate_results_tmp = $cate_results = array(); $sql = "SELECT info_cateid, title, info_catepid from " . DB::table('content_cate') . " WHERE isdelete=0 ORDER BY info_cateid ASC"; $cate_results_tmp = DB::fetch_all($sql); $cate_results_tree = dbarr2tree($cate_results_tmp); $tree2htmlul_infosearch = tree2htmlul_infosearch($cate_results_tree, 'tree treeFolder'); //DEBUG 获取分类树形菜单 END include template('admin/info/index_info_multi'); break; }
function tree2htmlul_catesearch($tree, $tree_class) { $tree2htmlul .= '<ul class="' . $tree_class . '">'; foreach ($tree as $leaf) { $tree2htmlul .= "<li><a href='admin.php?mod=info_cate&action=index&do=cate_ajax&info_cateid=" . $leaf['info_cateid'] . "' target='ajax' rel='jbsxBox'>" . $leaf['title'] . "</a>"; if (!empty($leaf['children'])) { $tree2htmlul .= tree2htmlul_infosearch($leaf['children']); } $tree2htmlul .= '</li>'; } $tree2htmlul .= '</ul>'; return $tree2htmlul; }