Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: perl pagination links

by poj (Prior)
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2017-07-25 21:05 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (380 votes). Check out past polls.