Php Laravel 5.3,将分页链接(<;>;>;)替换为图像
如何用图像替换自定义laravel分页? 我还希望在不重新加载页面的情况下获取下一组数据。 我的控制器看起来像这样Php Laravel 5.3,将分页链接(<;>;>;)替换为图像,php,ajax,laravel,laravel-5,pagination,Php,Ajax,Laravel,Laravel 5,Pagination,如何用图像替换自定义laravel分页? 我还希望在不重新加载页面的情况下获取下一组数据。 我的控制器看起来像这样 class HomeController extends Controller { public function index() { $featured_products = DB::table('products') ->where('feature_type','=',3) ->orderBy('cre
class HomeController extends Controller
{
public function index()
{
$featured_products = DB::table('products')
->where('feature_type','=',3)
->orderBy('created_at','DESC')
->simplePaginate(4);
$latest_products = DB::table('products')
->orderBy('created_at','DESC')
->simplePaginate(4);
return View::make('pages.home')
->with(['featured_products'=>$featured_products,'latest_products'=>$latest_products]);
}
}在5.3中,您可以
在其他版本中,您可以尝试使用CSS覆盖此选项,也可以尝试替代使用$results->render()
方法:
$results->count()
$results->currentPage()
$results->firstItem()
$results->hasMorePages()
$results->lastItem()
$results->lastPage() (Not available when using simplePaginate)
$results->nextPageUrl()
$results->perPage()
$results->previousPageUrl()
$results->total() (Not available when using simplePaginate)
$results->url($page)
最简单的方法是编辑分页的
blade
文件
首先,在您的控制台运行中:
php artisan vendor:publish --tag=laravel-pagination
然后转到resources/views/vendor/pagination/default.blade.php
,您将看到:
@if ($paginator->onFirstPage())
<li class="disabled"><span>«</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">«</a></li>
@endif
...
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">»</a></li>
@else
<li class="disabled"><span>»</span></li>
@endif
@if($paginator->onFirstPage())
«李>
@否则
@恩迪夫
...
@如果($paginator->hasMorePages())
@否则
»李>
@恩迪夫
您只需更换«代码>和»代码>与要使用的图像
希望这有帮助