is it possible to add a view All results link after or before the << First 1 2 3 Last >> links of the pagination?

I tried some thing like :

// in controller (search) :

if(uri_string()=='/search/results/all'){
            $config['per_page'] = $config['total_rows'];
        }else{
            $config['per_page'] = 10;
        }
$page['pagination'] = $this->pagination->create_links(); 

// and in the view :

echo $pagination .' '. '<a href="/search/results/all">View all results</a>';

Does anyone knows a better way?

有帮助吗?

解决方案

I think the better way is to extend the CI pagination class. For example:

class MY_Pagination extends CI_Pagination
{
      function create_links() {

           // modify the output here

           return $output;
      }
}

You can find a good example here: http://codeigniter.com/wiki/Digg_Style_Pagination_-_Non_evasive_aproach

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top