pagination() public static method

Generates a pagination.
public static pagination ( array $items, array $htmlOptions = [] ) : string
$items array the pagination buttons.
$htmlOptions array additional HTML attributes.
return string the generated pagination.
示例#1
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $links = $this->createPageLinks();
     if (!empty($links)) {
         echo TbHtml::pagination($links, $this->htmlOptions);
     }
 }
示例#2
0
 public function testPagination()
 {
     $I = $this->codeGuy;
     $items = array(array('label' => 'Prev', 'url' => '#', 'disabled' => true), array('label' => '1', 'url' => '#', 'active' => true, 'htmlOptions' => array('class' => 'item'), 'linkOptions' => array('class' => 'link')), array('label' => '2', 'url' => '#'), array('label' => '3', 'url' => '#'), array('label' => '4', 'url' => '#'), array('label' => '5', 'url' => '#'), array('label' => 'Next', 'url' => '#'));
     $html = TbHtml::pagination($items, array('class' => 'div', 'listOptions' => array('class' => 'list')));
     $div = $I->createNode($html, 'div.pagination');
     $I->seeNodeCssClass($div, 'div');
     $ul = $div->filter('ul');
     $I->seeNodeCssClass($ul, 'list');
     $I->seeNodeNumChildren($ul, 7);
     foreach ($ul->children() as $i => $liElement) {
         $li = $I->createNode($liElement);
         $a = $li->filter('a');
         if ($i === 0) {
             $I->seeNodeCssClass($li, 'disabled');
         }
         if ($i === 1) {
             $I->seeNodeCssClass($li, 'item active');
             $I->seeNodeCssClass($a, 'link');
         }
         $I->seeNodeAttribute($a, 'href', '#');
         $I->seeNodeText($a, $items[$i]['label']);
     }
     $html = TbHtml::pagination($items, array('size' => TbHtml::PAGINATION_SIZE_LARGE));
     $div = $I->createNode($html, 'div.pagination');
     $I->seeNodeCssClass($div, 'pagination-large');
     $html = TbHtml::pagination($items, array('align' => TbHtml::PAGINATION_ALIGN_CENTER));
     $div = $I->createNode($html, 'div.pagination');
     $I->seeNodeCssClass($div, 'pagination-centered');
     $html = TbHtml::pagination(array());
     $this->assertEquals('', $html);
 }
示例#3
0
<?php echo TbHtml::pagination(array(...), array('size' => TbHtml::PAGINATION_SIZE_SMALL)); ?>
&lt;?php echo TbHtml::pagination(array(...), array('size' => TbHtml::PAGINATION_SIZE_MINI)); ?></pre>

    <h3>Alignments</h3>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::pagination($paginationConfig, array('align' => TbHtml::PAGINATION_ALIGN_CENTER));
?>
    </div>
    <pre class="prettyprint linenums">
&lt;?php echo TbHtml::pagination(array(...), array('align' => TbHtml::PAGINATION_ALIGN_CENTER)); ?></pre>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::pagination($paginationConfig, array('align' => TbHtml::PAGINATION_ALIGN_RIGHT));
?>
    </div>
    <pre class="prettyprint linenums">
&lt;?php echo TbHtml::pagination(array(...), array('align' => TbHtml::PAGINATION_ALIGN_RIGHT)); ?></pre>

    <hr class="bs-docs-separator">

    <h2>Pager</h2>

    <h3>Default example</h3>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::pager(array(array('label' => 'Previous', 'url' => '#'), array('label' => 'Next', 'url' => '#')));
?>