完善了ajax分页的功能

This commit is contained in:
Li Jianxuan 2011-10-18 01:41:20 +00:00
parent 3d7b971d1e
commit b9b838c8c1
2 changed files with 10 additions and 26 deletions

View File

@ -452,12 +452,11 @@ class ReviewController extends Zend_Controller_Action
}//reviewAction()
function allreviewAction(){
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$page = $this->_getParam('page');
$uuid = $this->_request->getParam('uuid');
$offset = 5;
$sql = "select r.uuid,r.userid,r.ts_created,u.realname,r.mdcomment,r.conclusion from mdreview r
left join users u on u.id=r.userid
where r.uuid='$uuid'";
@ -467,12 +466,12 @@ class ReviewController extends Zend_Controller_Action
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
//$paginator->setItemCountPerPage(5);
//$paginator->setView($this->view);
$paginator->setItemCountPerPage(5);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('review/pagination_ajax.phtml');
$list = "";
foreach($rows as $k=>$v)
foreach($paginator as $k=>$v)
{
$list.='
<li>
@ -486,13 +485,9 @@ class ReviewController extends Zend_Controller_Action
$stringbuffer = "<ul class='reviewlist'>$list</ul>";
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo $stringbuffer.'<div class="paginator">'.$paginator.'</div>';
}
}//allreviewAction()
}

View File

@ -103,20 +103,9 @@
</div>
<script type="text/javascript" language="javascript">
loadmdcomment();
function loadmdcomment(page){
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>/";
var data = '';
if(page!='')
{
url+='page/'+page;
}
var data = '';
$.ajax({type: "POST",url: url,data: data,
success: function(html){$('#allcomments').html(html);},
beforeSend:function(){$('#allcomments').html('正在加载...');}
});
}
loadmdcomment(1);
function loadmdcomment(page){var url="/review/allreview/uuid/<?php echo $md['uuid'];?>/";if(page!=''){url+='page/'+page;}
$.ajax({type:"POST",url:url,data:'',success:function(html){$('#allcomments').html(html);},beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />正在加载...');}});}
</script>
<?php else: ?>