newsinfo.php里的代码
if($front['id']!=null){
$id = $front['id'];
echo "上一条:$front[title]";
}else{
echo "上一条:没有了";
}
echo " ";
if($after['id']!=null){
echo "下一条:$after[title]";
}else{
echo "下一条:没有了";
}
?>
========
action里的代码
public function newsinfo(){
$this->info = M('info')->where("cid=18 and id=" . $_GET['id'])->find();
$this->front=M('info')->where("cid=18 and idorder('id desc')->limit('1')->find();
$this->after=M('info')->where("cid=18 and id>".$_GET['id'])->order('id desc')->limit('1')->find();
$this->display();
}
没有想象中的难么难得!