Pager - Pagination Widget |
[eluser]wiredesignz[/eluser]
Based on code provided by xwero, this is an alternative to the pagination library, as a pagination widget. The pager views are attached to this post as a zip file. Code: <?php widget::run('Pager', $total_pages, $current_page); ?> Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
[eluser]xwero[/eluser]
Why did you go for the first generation of the function? I'm not very proud of the option settings, it's a bit of a mess.
[eluser]wiredesignz[/eluser]
Post some updates as you want xwero. I used this because it works for me. Thanks man.
[eluser]xwero[/eluser]
The last version of the function has less options because generation of the first, last, next and prev elements will not hurt the performance. The link_replacement setting is connected to the totalLinks, or in your version num_links, setting so i let that generate too. Basically you can use all the options or none of them in the view but you don't need to set them anymore when you call the function. I think this is more developer friendly and less ifing in the function. An addition is the formattedLink parameter. This moves the link creation from the view to the controller if you want. This makes an array of all the generated links with two keys: nr and link. So it's still possible to create the link in the view bu you have to use $first['nr'] instead of $first. Of course the idea is to use $first['link']. |
Welcome Guest, Not a member yet? Register Sign In |