修改ajax分页
This commit is contained in:
parent
edf9151e5d
commit
49d6c6e3c1
|
@ -453,11 +453,11 @@ class ReviewController extends Zend_Controller_Action
|
||||||
|
|
||||||
function allreviewAction(){
|
function allreviewAction(){
|
||||||
|
|
||||||
$this->_helper->layout->disableLayout();
|
$page = $this->_getParam('page');
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
|
||||||
|
|
||||||
$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,9 +467,9 @@ 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('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('review/pagination_ajax.phtml');
|
||||||
|
|
||||||
$list = "";
|
$list = "";
|
||||||
foreach($rows as $k=>$v)
|
foreach($rows as $k=>$v)
|
||||||
|
@ -486,6 +486,10 @@ 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>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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">
|
<script type="text/javascript" language="javascript">
|
||||||
loadmdcomment();
|
loadmdcomment();
|
||||||
function loadmdcomment(){
|
function loadmdcomment(page){
|
||||||
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>";
|
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>/";
|
||||||
var data = '';
|
var data = '';
|
||||||
$.ajax({
|
if(page!='')
|
||||||
type: "POST",
|
{
|
||||||
url: url,
|
url+='page/'+page;
|
||||||
data: data,
|
}
|
||||||
success: function(html){
|
var data = '';
|
||||||
$('#allcomments').html(html);
|
$.ajax({type: "POST",url: url,data: data,
|
||||||
},
|
success: function(html){$('#allcomments').html(html);},
|
||||||
beforeSend:function(){
|
beforeSend:function(){$('#allcomments').html('正在加载...');}
|
||||||
$('#allcomments').html('正在加载...');
|
|
||||||
},
|
|
||||||
/*
|
|
||||||
complete:function(){
|
|
||||||
$('#submit').val('提交');
|
|
||||||
$('#submit').removeAttr('disabled');
|
|
||||||
}*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue