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

View File

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