[eluser]imn.codeartist[/eluser]
Quote:Hello
How do I go about passing a class to a Pagination link? Also, how do I configure it so that it only shows the current page? Ex:
<< < 3 > >>
instead of
<< < 1 2 3 4 5 > >>
you need to make some changes in pagination class at system/libraries/pagination.php
Find the below code in function create_links() at pagination class
Code:
for ($loop = $start -1; $loop <= $end; $loop++)
{
$i = ($loop * $this->per_page) - $this->per_page;
if ($i >= 0)
{
if ($this->cur_page == $loop)
{
$output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page
}
else
{
$n = ($i == 0) ? '' : $i;
$output .= $this->num_tag_open.'<a >base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
}
}
}
Code:
if ($this->cur_page == $loop)
{
$output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page
}
//Comment the else block as it won't display any other numbers rather than current page selected
/*else
{
$n = ($i == 0) ? '' : $i;
$output .= $this->num_tag_open.'<a >base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
}*/
Quote:Also, how do I set it so it doesn’t show the “Last” link?
And not to show the "last Link"
comment the follow code of function create_links() of pagination class
Code:
// Render the "Last" link
/*
if (($this->cur_page + $this->num_links) < $num_pages)
{
$i = (($num_pages * $this->per_page) - $this->per_page);
$output .= $this->last_tag_open.'<a >base_url.$i.'">'.$this->last_link.'</a>'.$this->last_tag_close;
}*/