Pagination with anchor in URLs

Hi,
I’m using standard rails pagination (I know it’s not perfect but it
suits me humble needs).
I want to add an anchor to the url.
Like making
article/2?page=5
to
article/2?page=5#content

I haven’t found an option in the paginator. Can someone help me please?

Thanks very much.

Ernst Beiglböck wrote:

Hi,
I’m using standard rails pagination (I know it’s not perfect but it
suits me humble needs).
I want to add an anchor to the url.
Like making
article/2?page=5
to
article/2?page=5#content

I haven’t found an option in the paginator. Can someone help me please?

Thanks very much.

Use this one above to navigate down to where you want the scroll to go
:smiley:

Sorry, but you misunderstood me.
I want that a command like
<%= pagination_links(@slide_pages) %>
appends #content to all URLs it generates.
So that you have

for example.

On 2/14/07, Jamal S. [email protected] wrote:

Posted via http://www.ruby-forum.com/.


wer viel lest ist viel gebildet.

On 2/13/07, Ernst Beiglböck [email protected] wrote:

Sorry, but you misunderstood me.
I want that a command like
<%= pagination_links(@slide_pages) %>
appends #content to all URLs it generates.
So that you have

for example.

Just add something like this in your application_helper.rb: (modify the
next
and previous to add #content.) So in your view you would call
<%=pagination(@slide_pages)%>.

def pagination(pages)
  rvalue = "<span id=\"pagination\">"
  if pages.current.previous
    rvalue << link_to('Previous page', { :action => 'list', :page =>

pages.current.previous})
rvalue << "  |  " if pages.current.next
end

  if pages.current.next
    next_page = pages.current.next
    page_no = next_page.to_i - 1
    rvalue << %(pg. #{page_no} of #{pages.length})
    rvalue << "&nbsp;&nbsp;|&nbsp;&nbsp;"
    rvalue << link_to('Next page', { :action => 'list', :page =>

next_page})
end
rvalue << “”
rvalue
end


Andrew S.

Thanks, it works

On 2/14/07, Andrew S. [email protected] wrote:

for example.
rvalue << link_to(‘Previous page’, { :action => ‘list’, :page =>
rvalue << link_to(‘Next page’, { :action => ‘list’, :page =>


wer viel lest ist viel gebildet.