Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 examining the Monastery: (8)
As of 2015-07-07 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls