get_info($db,$form); $smarty->assign("info",$info); //前後 $news_list = $this->get_news_list($db,$form); for ($i=0;$i= 2) { $next_id = $news_list[$target_id -2]["ID"]; } else { $next_id = 0; } $smarty->assign("prev_id",$prev_id); $smarty->assign("next_id",$next_id); } function get_info($db,$form) { $sql = "SELECT A.* FROM wp_posts A WHERE A.post_type ='news' and A.post_status ='publish' and ID = ? order by A.menu_order ASC, A.post_date DESC "; $param=array($form["news_id"]); $info = $db->get_row($sql,$param); return $info; } function get_news_list($db,$form) { $sql = "SELECT A.* FROM wp_posts A WHERE A.post_type ='news' and A.post_status ='publish' order by A.menu_order ASC, A.post_date DESC "; $news_list = $db->get_all($sql); return $news_list; } } new ExPage(); ?>