Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: perl pagination links

by poj (Priest)
on Apr 03, 2014 at 19:04 UTC ( #1080992=note: print w/ replies, xml ) Need Help??


in reply to perl pagination links

Consider simplifying the page link code to something like this

# page links my $pagelinks; if ($reqpage > 1){ my $prev_page = $reqpage - 1; $pagelinks .= qq! <a href="?reqpage=$prev_page"> Previous </a> !; } for my $pageno (1..$pagecount){ if ($pageno == $reqpage){ $pagelinks .= qq! <strong>$pageno</strong>!; } else { $pagelinks .= qq! <a href="?reqpage=$pageno"> $pageno </a> !; } } if ($reqpage < $pagecount){ my $next_page = $reqpage + 1; $pagelinks .= qq! <a href="?reqpage=$next_page"> Next </a> !; }
poj


Comment on Re: perl pagination links
Download Code
Re^2: perl pagination links
by ironside (Acolyte) on Apr 03, 2014 at 22:31 UTC

    poj you're absolutely brilliant! That did the trick. I did a lot of testing and I had a feeling that's where the problem was.

    Thank you for taking the time to help. Perl Monks are top class.
    Cheers poj!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1080992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-10-26 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (151 votes), past polls