public function menulistAction() { $m = new PSys_MenuModel(); $pid = reqnum("pid", 0); $page = reqnum('page', 1); $pagesize = 20; if ($pid == 0) { $where = ''; } else { $where = array(); $where["pid"] = $pid; } $order = " id ASC "; $result = $m->GetList($where, $order, $page, $pagesize, "*"); if ($result['allnum'] % $pagesize) { $last = floor($result['allnum'] / $pagesize) + 1; } else { $last = $result['allnum'] / $pagesize; } if ($page > 1) { $this->smarty->assign("pre", $page - 1); } else { $this->smarty->assign("pre", 1); } if ($page == $last) { $this->smarty->assign("next", $last); } else { $this->smarty->assign("next", $page + 1); } $this->smarty->assign("last", $last); $this->smarty->assign("tree", $result["allrow"]); $this->smarty->assign("total_num", $result["allnum"]); $this->forward = "menulist"; }