Created
January 24, 2013 22:17
-
-
Save eduardoromero/4628611 to your computer and use it in GitHub Desktop.
Foundation flavored Pagination for CakePHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $current = $this->Paginator->counter(array('format' => '%page% ')); $Next = $current + 1; $Prev = $current - 1; ?> | |
<?php $numbers = $this->Paginator->numbers(array('separator' => '', 'tag'=>'li'));?> | |
<?php if($numbers): ?> | |
<div class="row"> | |
<ul class="pagination"> | |
<!-- prev --> | |
<?php if($this->Paginator->hasPrev()) : ?> | |
<li> | |
<?php echo $this->Paginator->link('«', array("page" => $Prev), array('escape' => false)); ?> | |
</li> | |
<?php else: ?> | |
<li class="arrow unavailable"><a href="#">«</a></li> | |
<?php endif;?> | |
<!-- numbers --> | |
<?php | |
/* fix the "current" link */ | |
$numbers = preg_replace('/<li class="current">(\d+)<\/li>/', '<li class="current"><a href="#">$1</a></li>', $numbers); | |
// $numbers = str_replace('current', 'active', $current); | |
?> | |
<?php echo $numbers; ?> | |
<!-- next --> | |
<?php if($this->Paginator->hasNext()) : ?> | |
<li> | |
<?php echo $this->Paginator->link('»', array("page" => $Next), array('escape' => false)); ?> | |
</li> | |
<?php else: ?> | |
<li class="arrow unavailable"><a href="#">»</a></li> | |
<?php endif;?> | |
</ul> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
views/elements/Foundation.cake-paginator.ctp
Just use:
On your index.ctp