Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

building a dynamic webpage

by rjsaulakh (Beadle)
on Dec 07, 2005 at 18:04 UTC ( #514945=perlquestion: print w/replies, xml ) Need Help??
rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

I have to design a web page which should display a table consiting of rows . The rows are in large number about 300 and I want to maintain it in database . I want to diplay 15 rows per page , so I would require to break the 300 rows in several no of pages . the no of rows will be dynamic so the numbers of pages will also change depending on the number of rows .

The display functionaltiy should be same to somewhat as in a google . I want to have this database in form of a text file . I want to have hyperlinks on my page which consist of numbers 1 2 3 10 , next and previous button the hyperlinks displayed should change depending on the page I am currently viewing . suppose if I am on page no 7 the hyperlinks to 1 2 3 should hide and pages with hyperlinks as 11 12 13 get diplayed. Please help me what should be my approach and if there any live website which can help me

Replies are listed 'Best First'.
Re: building a dynamic webpage
by Ovid (Cardinal) on Dec 07, 2005 at 18:10 UTC
Re: building a dynamic webpage
by injunjoel (Priest) on Dec 07, 2005 at 18:30 UTC
    Well first off a key part of this is the DataBase you select to use. MySQL has LIMIT which will make you life very easy, other DB's may do it a little differently (or not at all). So I will assume you are using MySQL.
    Now based on your request I am unable to tell your level of scripting proficiency but I get the feeling you are probably new to Perl so here are some good places to start.
    • CPAN The true reason Perl is so powerful. Search for DBI, CGI and HTML::Template to start with
    • MySQL you can search the site for "LIMIT" for example.
    • Ovid's CGI course might be useful as well.
    Just a few hints.
    1. set an offset {what row to start on} and a limit {how many to get each time} in your script and pass them around, each page increment your offset by your limit.
    2. indexes are your friends in MySQL they make searching much more efficient.
    3. make your display a template... do not, I repeat DO NOT start off mixing HTML into your script! HTML::Template is good at helping you aviod this, so read the documentation on CPAN (Others might argue this point with me but I feel it is better to learn good habits early rather than unlearning bad ones eventually)

    I hope that helps point you in the right direction... you may have a lot of reading to do. If you get stuck come on back and ask.

    "I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
Re: building a dynamic webpage
by Fletch (Chancellor) on Dec 07, 2005 at 18:30 UTC

    Well, you could write some Perl which like does that stuff using those module things. And stuff.

    And you should learn how to ask more cogent questions.

    Update: I was going to add a list of links to posts where the OP's been pointed at things like How (Not) To Ask A Question (e.g. CGI perl) numerous times before, but it's not worth it. They didn't learn then, they're not going to now.

Re: building a dynamic webpage
by philcrow (Priest) on Dec 07, 2005 at 18:45 UTC
Re: building a dynamic webpage
by kulls (Hermit) on Dec 08, 2005 at 04:01 UTC
    implement HTML::Pager.This will satisfy all your criteria's.
    more info about HTML::Pager
Re: building a dynamic webpage
by Anonymous Monk on Dec 08, 2005 at 18:23 UTC

      thx for ur information , but request you to have some amount of documentation in ur code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://514945]
Approved by sgifford
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2017-03-29 02:23 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (343 votes). Check out past polls.