Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: perl pagination links

by poj (Vicar)
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
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?
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 making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-09-04 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (128 votes), past polls