|
May
21
|
‘will_paginate‘ is one of the most widely used plugins in most of the ruby on rails projects.will_paginate is an alternative to the classic_pagination plugin, which is the pagination plugin that basically took the pre Rails 2.0 pagination implementation and packaged it in plugin form
1.How to Install will_paginate
the simple method
gem install mislav-will_paginate
There are some other method you can find it here.
2.Example
In controller
@gallery=Gallery.find(:all,:order=>”position asc”).paginate :page => page,:per_page=>10
where :per_page passes the number of gallery you want to display.You can change it according to your need 1-100
will_paginate defines it to be 30 by default
In View
you can simply use
<%= will_paginate @gallery %>
some advanced …
<% if @gallery.previous_page %>
<%= will_paginate @gallery,:page_links=>false, :next_label => “”, :prev_label => image_tag(“/images/icon/arrow.png”, :border => “0″) %>
<% end %>
<% if @gallery.next_page %>
<%= will_paginate @gallery,:page_links=>false, :next_label => image_tag(“/images/icon/arrow.png”,, :border => “0″), :prev_label => “” %>
<% end %>
If we put page_links=>false then it won’t display 1,2,3… and next_label and prev_label => “” as null it won’t display Next and Prev
Ryan Bates made an awesome screencast check it out here
June 15th, 2009 at 3:21 am
Thank you so much for this post. I use the reviewazon plugin.
February 25th, 2010 at 6:53 pm
ATYXYj qaayxfbinktw, [url=http://nixopqomnaht.com/]nixopqomnaht[/url], [link=http://chahuwkudvmp.com/]chahuwkudvmp[/link], http://dfhsumjrkush.com/
March 5th, 2010 at 2:32 pm
I’ve been using the great ReviewAZON wordpress plugin for several months now. It’s a great and user friendly plugin that speeds up the creation of Amazon product wordpress blogs
March 17th, 2010 at 11:47 pm
6o0cvV xcsuhgzvyvmi, [url=http://astphptchnpj.com/]astphptchnpj[/url], [link=http://ysehdjfzzlfx.com/]ysehdjfzzlfx[/link], http://aeqluziszxmk.com/
April 5th, 2010 at 9:10 pm
Fantastic summary, this is very similar to a site that I have. Please check it out sometime and feel free to leave me a comenet on it and tell me what you think. Im always looking for feedback.
April 23rd, 2010 at 9:28 pm
Here is another good post regarding getting a lot of traffic from Twitter via your WordPress sites. Check it here: http://www.wordpressrobot.com/5-steps-to-becoming-highly-infectious-on-twitter
April 28th, 2010 at 2:49 pm
I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favorites weblog list and will be checking back soon. Please check out my site as well and let me know what you think.
April 29th, 2010 at 7:57 pm
This is a good post, I stumbled across your story while looking for some random stuff. Thanks for sharing, I’ll be sure to come back.
May 14th, 2010 at 7:01 am
I’m pleased I located this web site, I couldnt find any knowledge on this matter prior to. Also operate a site and if you want to ever interested in doing some visitor writing for me you should feel free to let me know, i’m always look for people to check out my site. Please stop by and leave a comment sometime!
May 20th, 2010 at 8:21 am
hi wats your myspace page
June 1st, 2010 at 2:40 pm
Fantastic blog post, this is very similar to a site that I have. Please check it out sometime and feel free to leave me a comenet on it and tell me what you think. I’m always looking for feedback.
June 4th, 2010 at 12:47 pm
Here is another excellent blog regarding getting mass traffic from Twitter with your WordPress based website. Check it here: http://www.wordpressrobot.com/5-steps-to-becoming-highly-infectious-on-twitter You can use unlimited Twitter accounts to tweet from and use proxy IP’s if you prefer. This will absolutely bring in tons of visitors from Twitter to all your WordPress sites. All completely on autopilot!
June 8th, 2010 at 7:22 am
This is a exceptional blog, I located your site checking yahoo for a related topic and arrived to this. I couldnt discover to much other info on this post, so it was great to locate this one. I will likely end up being back to check out some other posts that you have another time.
June 19th, 2010 at 12:29 pm
Whats up, This is a fantastic summation, I located your blog checking google for any similar subject and observed this. I couldnt find too significantly other tips and details on this posting, so it was good to find this one. I am going to most likely be returning to take into account many other content which you have written an additional time.