Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

pagination and display of table content

by rjsaulakh (Beadle)
on Dec 17, 2005 at 10:32 UTC ( [id://517459]=perlquestion: print w/replies, xml ) Need Help??

rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

hi monks i have data in form of text file which i have to display in a page . per page only three rows should be displayed and there should be hyper links for other pages

Data for the 1st row 1st column    data for 1st row 2nd column
Data for the 2nd row 1st column     data for 2nd row 2nd column
Data for the 3rd row 1st column     data for 3rd row 2nd column
Data for the 4th row 1st column     data for 4th row 2nd column
Data for the 5th row 1st column     data for 1st row 2nd column
Data for the 6th row 1st column     data for 6th row 2nd column
Data for the 7th row 1st column     data for 7th row 2nd column
Data for the 8th row 1st column     data for 8th row 2nd column
Data for the 9th row 1st column     data for 9th row 2nd column
Data for the 10th row 1st column    data for 10th row 2nd column

the data in first column is separated from data in second column by two tabs

i have coded a few lines for paging

#!/usr/bin/perl use CGI; my $cgi=new CGI; print $cgi->header; #here im using rows module in which i am calculating the no of rows use rows; $totalcount= rows::count_rows(); print "$totalcount \n \n "; #so put all the values inside an array say @total. $no_per_page=3; $total_pages=int((scalar $totalcount) / $no_per_page); print "$total_pages \n \n "; $remainder = (scalar $totalcount) % $no_per_page; if ($remainder) { $total_pages++; print $total_pages; } if($total_pages) { print <<"END"; <table cellpadding="0" cellspacing="0" bor +der="0" width="100%"> <tr> <td class="smtxt"> END print "<b>Page&nbsp;</b>"; for $i (1 .. $total_pages) { if ($i == $page) { print "<b>$i</b>"; } else { print "<a href=\"winner.cgi?page=$i&period=$p +eriod\">$i</a>"; } if ($i != $total_pages) { print "&nbsp;|&nbsp;"; } } print "<!-- '$total_pages' '$remainder' --></td></tr></table>\ +n"; }

i am able to determine the no of rows and no of pages required to display all the rows . the trows are more than 300 in number so i have to use previous and next button also and use search funcitonality where as i proceed on the pages some hyperlinks get dispalyed and some get hidden

please help me what ashould be my approach , i cant use anything except cgi.pm module

please help me how shuold i go

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://517459]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-03-28 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found