tadcka/paginator-bundle

Symfony2 管理分页

安装: 257

依赖: 3

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

v0.1.0 2014-03-27 20:32 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:08:36 UTC


README

分页包。

安装

步骤 1: 使用 composer 下载 TadckaPaginatorBundle

在 composer.json 中添加 TadckaPaginatorBundle

{
    "require": {
        "tadcka/paginator-bundle": "dev-master"
    }
}

现在运行命令让 composer 下载包

$ php composer.phar update tadcka/paginator-bundle

步骤 2: 启用包

在 kernel 中启用包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Tadcka\PaginatorBundle\TadckaPaginatorBundle(),
    );
}

如何使用?

步骤 3: 如何使用?

创建分页对象

<?php
$pagination = new \Tadcka\Component\Paginator\Pagination($totalItems, $currentPage, $itemsPerPage);

渲染 HTML

<?php
$paginationHtml = $this->container->get('tadcka_paginator.manager')->getPaginatorHtml($pagination);

步骤 4: 配置

tadcka_paginator:
  max_near_pages: 3
  template_class:
    pagination: test
    pagination_links: test_links
    pagination_link: test_link