1, set the paging container reference laraver manual My setup code is as follows:
//set up a paging container/app/models/zurbpresenter.php
<?php
classZurbpresenter extends Illuminate\pagination\presenter {
Publicfunction Getpagelinkwrapper ($url, $page, $rel =NULL)
{
$rel = Is_null ($rel)?"':'rel= "'. $rel.'"';
return'<li><a href=javascript:goodslist ("'. $url.'");>'. $page.'</a></li>';
}
Publicfunction Getdisabledtextwrapper ($text)
{
return'<li class= "disabled" ><span>'. $text.'</span></li>';
}
Publicfunction Getactivepagewrapper ($text)
{
return'<li class= "active" ><span>'. $text.'</span></li>';
}
}
//set up a paging template/app/view/page/page.blade.php
<ulclass="pagination">
<?php Echo with (NewZurbpresenter ($paginator))->render ();?>
</ul>
//setting up the configuration file/app/config/view.php
<?php
returnArray
'Paths'= = Array (__dir__.'/.. /views'),
//' pagination ' = ' pagination::slider-3 ',
'pagination'='Page.page',
);
2, the controller calls the method: code as follows
Privatefunction Toajaxtpl ($templateFile ="', $data ="') {
$viewobj = View::make ($templateFile, Array ('Data'= $data));
$path = $viewobj->getpath ();
Ob_start ();
Ob_implicit_flush (0);
Include ($path);
$content = Ob_get_clean ();
return$content;
}
Publicfunction GetList () {
$reult = $ This->brand->paginate (2);
$content = $ This->TOAJAXTPL ('member::p ublish.ajaxtpl.ajaxsold', $reult);
$data = ['Status'=true,'Data'= $content];
returnResponse::json ($data);
}
3, Ajax page template code
<thead>
<tr>
<th> Products </th>
<th> Amount </th>
<th> Release Time </th>
<th> Expiry Time </th>
<th> Operations </th>
</tr>
</thead>
<tbody>
<?php
foreach($data as$d) {
?>
<tr>
<TD valign="Middle">
<a href="">".. /images/ucenter/nail.jpg"Width=" the"height=" the"/><?php echo $d->title;?></a> </td>
<td>9999 Yuan 11</td>
<td><?php Echo $d->created_at;?></td>
<td><?php Echo $d->validity_date;?></td>
<td><iclass="icon Icon-eye-open tip0"data-toggle="tooltip"Data-placement="Top"title="View"></i> |
<iclass="icon Icon-edit tip0"data-toggle="tooltip"Data-placement="Top"title="Edit"></i> <br/> <iclass="icon Icon-chevron-down tip0"data-toggle="tooltip"Data-placement="Top"title="Lower Shelf"></i> | <iclass="icon Icon-remove tip0"data-toggle="tooltip"Data-placement="Top"title="Delete"></i>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<TD cols='5'> <?php echo $data->links ();?></td>
</tr>
</tfoot>
................
//JS Code:
<script type="Text/javascript">
varTm_classify=[];
function expire () {
varURL ='{{route ("Member.publish.getlist")}}';
$.getjson (url,function (data) {
Console.info (data);
$('#expire'). HTML (data.data);
});
};
function goodslist (URL) {
$.getjson (url,function (data) {
$('#expire'). HTML (data.data);
});
}
</script>
Laraver Ajax Paging