濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > Laravel框架自定義分頁樣式操作示例

Laravel框架自定義分頁樣式操作示例

熱門標(biāo)簽:青島語音外呼系統(tǒng)招商 河南電銷卡外呼系統(tǒng)哪家強(qiáng) 揚(yáng)州地圖標(biāo)注app 山西回?fù)芡夂粝到y(tǒng) 昭通辦理400電話 百應(yīng)電話機(jī)器人服務(wù) 山西探意電話機(jī)器人 騰訊外呼管理系統(tǒng) 岳陽外呼型呼叫中心系統(tǒng)在哪里

本文實(shí)例講述了Laravel框架自定義分頁樣式操作。分享給大家供大家參考,具體如下:

操作步驟如下:

(1)  對(duì)應(yīng)public/css/paging.css 文件建立分頁樣式.

(2)  控制器查出分頁數(shù)據(jù)使用 paginate函數(shù)進(jìn)行分頁處理.(禁止使用group by處理查詢).

(3) 對(duì)應(yīng)視圖引入分頁樣式.

例如: paging.css 樣式文件代碼(復(fù)制即可用,實(shí)際操作過)如下

  #pull_right{
    text-align:center;
  }
  .pull-right {
    /*float: left!important;*/
  }
  .pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
  }
  .pagination > li {
    display: inline;
  }
  .pagination > li > a,
  .pagination > li > span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    color: #428bca;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
  }
  .pagination > li:first-child > a,
  .pagination > li:first-child > span {
    margin-left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
  }
  .pagination > li:last-child > a,
  .pagination > li:last-child > span {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
  }
  .pagination > li > a:hover,
  .pagination > li > span:hover,
  .pagination > li > a:focus,
  .pagination > li > span:focus {
    color: #2a6496;
    background-color: #eee;
    border-color: #ddd;
  }
  .pagination > .active > a,
  .pagination > .active > span,
  .pagination > .active > a:hover,
  .pagination > .active > span:hover,
  .pagination > .active > a:focus,
  .pagination > .active > span:focus {
    z-index: 2;
    color: #fff;
    cursor: default;
    background-color: #428bca;
    border-color: #428bca;
  }
  .pagination > .disabled > span,
  .pagination > .disabled > span:hover,
  .pagination > .disabled > span:focus,
  .pagination > .disabled > a,
  .pagination > .disabled > a:hover,
  .pagination > .disabled > a:focus {
    color: #777;
    cursor: not-allowed;
    background-color: #fff;
    border-color: #ddd;
  }
  .clear{
    clear: both;
  }

例如:TestCntroller.php 控制器示例寫法

?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class TestController extends Controller{
  /**
   * 測(cè)試數(shù)據(jù)
   */
  public function index()
  {
    $test = DB::table('test')->paginate(5);
    return view('index', ['test' => $test]);
  }
}

例如: list.blade.php 視圖文件代碼示例寫法

!--用于引用css-->
link rel="stylesheet" type="text/css" href="{{asset('css/paging.css')}}" rel="external nofollow" />
div class="container">
  !--查數(shù)據(jù)-->
  @foreach ($test as $value)
    {{ $value->id }}
  @endforeach
/div>
div id="pull_right">
  !--分頁寫法-->
  div class="pull-right">
    {{ $test->render() }}
  /div>
/div>

樣式如下圖:

更多關(guān)于Laravel相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Laravel框架入門與進(jìn)階教程》、《php優(yōu)秀開發(fā)框架總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》

希望本文所述對(duì)大家基于Laravel框架的PHP程序設(shè)計(jì)有所幫助。

您可能感興趣的文章:
  • Laravel5.5 手動(dòng)分頁和自定義分頁樣式的簡(jiǎn)單實(shí)現(xiàn)
  • PHP框架Laravel插件Pagination實(shí)現(xiàn)自定義分頁
  • laravel自定義分頁效果
  • laravel自定義分頁的實(shí)現(xiàn)案例offset()和limit()
  • laravel實(shí)現(xiàn)分頁樣式替換示例代碼(增加首、尾頁)
  • Laravel手動(dòng)分頁實(shí)現(xiàn)方法詳解
  • Laravel+jQuery實(shí)現(xiàn)AJAX分頁效果
  • Laravel框架執(zhí)行原生SQL語句及使用paginate分頁的方法
  • laravel手動(dòng)創(chuàng)建數(shù)組分頁的實(shí)現(xiàn)代碼

標(biāo)簽:湛江 婁底 鎮(zhèn)江 寶雞 黃南 銅川 宜賓 南陽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Laravel框架自定義分頁樣式操作示例》,本文關(guān)鍵詞  Laravel,框架,自定義,分頁,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Laravel框架自定義分頁樣式操作示例》相關(guān)的同類信息!
  • 本頁收集關(guān)于Laravel框架自定義分頁樣式操作示例的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    治县。| 乐昌市| 富锦市| 华容县| 余江县| 克山县| 奈曼旗| 武山县| 建宁县| 唐山市| 古浪县| 潜山县| 麻栗坡县| 仙桃市| 仁怀市| 五原县| 桂东县| 岗巴县| 大名县| 漠河县| 镇赉县| 阜南县| 舟山市| 安阳县| 聊城市| 肇东市| 朝阳县| 哈密市| 安岳县| 福清市| 曲沃县| 临猗县| 福泉市| 滁州市| 长武县| 贵溪市| 青河县| 红桥区| 锦州市| 苏州市| 林口县|