Skip to content

Instantly share code, notes, and snippets.

@LucianoCharlesdeSouza
Last active February 6, 2018 01:33
Show Gist options
  • Select an option

  • Save LucianoCharlesdeSouza/79afd1c72f02ae2a4f13d49ef499a027 to your computer and use it in GitHub Desktop.

Select an option

Save LucianoCharlesdeSouza/79afd1c72f02ae2a4f13d49ef499a027 to your computer and use it in GitHub Desktop.
$this->Links[] = "<div class=\"col-sm-12 text-center\"><ul class=\"pagination\">";
$first = "<li class=\"active\"></li>";
if ($this->getPager() > 1):
$first = "<li><a class=\"\" href=\"?" . $this->getPage() . "=1\">Primeira</a></li>";
endif;
$this->Links[] = $first;
for ($i = $this->getPager() - $this->getMaxLinks(); $i <= $this->getPager() - 1; $i++):
if ($i >= 1):
$this->Links[] = "<li><a href=\"?" . $this->getPage() . "=" . $i . "\">" . $i . "</a></li>";
endif;
endfor;
$this->Links[] = "<li class=\"active\"><span>" . $this->getPager() . "</span></li>";
for ($i = $this->getPager() + 1; $i <= $this->getPager() + $this->getMaxLinks(); $i++):
if ($i <= $total_pages):
$this->Links[] = "<li><a href=\"?" . $this->getPage() . "=" . $i . "\">" . $i . "</a></li>";
endif;
endfor;
$last = "<li class=\"active\"></li></ul>";
if ($this->getPager() != $total_pages):
$last = "<li><a class=\"\" href=\"?" . $this->getPage() . "=" . $total_pages . "\">Última</a></li></ul></div>";
endif;
$this->Links[] = $last;
endif;
return $this->Links;
@wilcorrea

wilcorrea commented Feb 6, 2018

Copy link
Copy Markdown
$this->links[] = '<div class="col-sm-12 text-center"><ul class="pagination">';
$first = '<li class="active"></li>';
if ($this->getPager() > 1) {
    $first = '<li><a class="" href="?' . $this->getPage() . '=1">Primeira</a></li>';
}
$this->links[] = $first;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment