修改ajax分页
This commit is contained in:
parent
edf9151e5d
commit
49d6c6e3c1
|
@ -453,11 +453,11 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
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,9 +467,9 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(5);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
//$paginator->setItemCountPerPage(5);
|
||||
//$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('review/pagination_ajax.phtml');
|
||||
|
||||
$list = "";
|
||||
foreach($rows as $k=>$v)
|
||||
|
@ -486,6 +486,10 @@ 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>';
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php if ($this->pageCount): ?>
|
||||
<div class="paginationControl">
|
||||
<!-- Previous page link -->
|
||||
<?php if (isset($this->previous)): ?>
|
||||
<a href="javascript:void(0);" onclick="loadmdcomment(<?php echo $this->previous;?>)">< Previous</a>
|
||||
<?php else: ?>
|
||||
<span class="disabled">< Previous</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Numbered page links -->
|
||||
<?php foreach ($this->pagesInRange as $page): ?>
|
||||
<?php if ($page != $this->current): ?>
|
||||
<a href="javascript:void(0);" onclick="loadmdcomment(<?php echo $page;?>)"><?= $page; ?></a>
|
||||
<?php else: ?>
|
||||
<span class="current"><?= $page; ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<!-- Next page link -->
|
||||
<?php if (isset($this->next)): ?>
|
||||
<a href="javascript:void(0);" onclick="loadmdcomment(<?php echo $this->next;?>)">Next ></a>
|
||||
<?php else: ?>
|
||||
<span class="disabled">Next ></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -104,24 +104,17 @@
|
|||
|
||||
<script type="text/javascript" language="javascript">
|
||||
loadmdcomment();
|
||||
function loadmdcomment(){
|
||||
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>";
|
||||
function loadmdcomment(page){
|
||||
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>/";
|
||||
var data = '';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: data,
|
||||
success: function(html){
|
||||
$('#allcomments').html(html);
|
||||
},
|
||||
beforeSend:function(){
|
||||
$('#allcomments').html('正在加载...');
|
||||
},
|
||||
/*
|
||||
complete:function(){
|
||||
$('#submit').val('提交');
|
||||
$('#submit').removeAttr('disabled');
|
||||
}*/
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue