sawarame
4/14/2018 - 12:06 PM

zend-paginatorのテンプレート

<?php if ($this->pageCount): ?>
<div class="clearfix">
    <div class="pull-left">
        <nav>
            <ul class="pagination">
                <li>
                    <?= $this->totalItemCount ?>件中
                    <?= $this->firstItemNumber ?> -
                    <?= $this->lastItemNumber ?> を表示
                    <div class="btn-group">
                        <button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                            <?= $this->itemCountPerPage ?> 件表示
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 10], ['query' => $this->query]); ?>">10件表示</a></li>
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 30], ['query' => $this->query]); ?>">30件表示</a></li>
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 50], ['query' => $this->query]); ?>">50件表示</a></li>
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 100], ['query' => $this->query]); ?>">100件表示</a></li>
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 200], ['query' => $this->query]); ?>">200件表示</a></li>
                            <li><a tabindex="-1" href="<?= $this->url($this->route, ['count' => 500], ['query' => $this->query]); ?>">500件表示</a></li>
                        </ul>
                    </div>
                </li>
            </ul>
        </nav>
    </div>
    <div class="pull-right">
        <nav>
            <ul class="pagination pagination-sm">
                <?php /* 最初のページヘのリンク */ ?>
                <li class="<?= isset($this->previous)? '' : 'disabled' ?>">
                    <a href="<?= $this->url($this->route, ['page' => $this->first, 'count' => $this->itemCountPerPage], ['query' => $this->query]); ?>">
                        <span>«</span>
                    </a>
                </li>

                <?php /* ページ番号へのリンク */ ?>
                <?php foreach ($this->pagesInRange as $page): ?>
                    <li class="<?= $page == $this->current? 'active' : ''  ?>">
                        <a href="<?= $this->url($this->route, ['page' => $page, 'count' => $this->itemCountPerPage], ['query' => $this->query]); ?>">
                            <?= $page; ?>
                        </a>
                    </li>
                <?php endforeach  ?>

                <?php /* 最後のページヘのリンク */ ?>
                <li class="<?= isset($this->next)? '' : 'disabled' ?>">
                    <a href="<?= $this->url($this->route, ['page' => $this->last, 'count' => $this->itemCountPerPage], ['query' => $this->query]); ?>">
                        <span>»</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>
<?php endif; ?>