Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: perl pagination links

by poj (Parson)
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> !; }

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2016-10-22 19:53 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (297 votes). Check out past polls.