Scrolling through Blog Pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • realin
    Contributor
    • Feb 2007
    • 254

    Scrolling through Blog Pages

    hey guyss, whatzz up..

    i have joined this forum 10 mins back and i m here with a query, well i jus want to know while i want to display the enteries from my blog, how to i scroll thru pages..

    I mean i display the latest five on first page, then do i need to create manually all other pages??

    or there is some technique with is followed ???

    Thanks a lot
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by realin
    hey guyss, whatzz up..

    i have joined this forum 10 mins back and i m here with a query, well i jus want to know while i want to display the enteries from my blog, how to i scroll thru pages..

    I mean i display the latest five on first page, then do i need to create manually all other pages??

    or there is some technique with is followed ???

    Thanks a lot
    Perhaps you could describe your system a little more thoroughly. It's hard to fix a system which you know nothing about.

    Comment

    • realin
      Contributor
      • Feb 2007
      • 254

      #3
      Originally posted by Motoma
      Perhaps you could describe your system a little more thoroughly. It's hard to fix a system which you know nothing about.

      mayne, its jus like this forum you take.. if a thread got 10 or more replies then a next page is created for the further replies.. in the same way, i want to know a way that how do i create a functionality like this ;)

      hope its clear now :)

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Originally posted by realin
        mayne, its jus like this forum you take.. if a thread got 10 or more replies then a next page is created for the further replies.. in the same way, i want to know a way that how do i create a functionality like this ;)

        hope its clear now :)
        Well, I understand you are using PHP; however, I have no clue how you are storing the thread information. Are you using a database? MySQL, MSSQL, PostgreSQL, Access, flat file, hard coded html?
        Are you using any database classes such as ADODB?
        Are you using any template classes, like Smarty or tinytemplate?

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Hi.

          If your using a MySQL database, you will most likely have a query where you fetch your data.

          You can add to this qery a limit clause, to limit the data it returns to you.
          Somwhat like this
          [PHP]
          // The number of posts to show on each page
          $PostsPerPage = 5;

          // The number of the page, say you have
          // 15 posts and you show 5 per page
          // and your user had selected page 2 of 3
          $PageNr = 1; // 1 being page number 2 when counting from 0

          // Your sql query
          $QUERY = "SELECT * FROM mytbl LIMIT " $PostsPerPage * $PageNr .", ". $PostsPerPage;

          [/PHP]

          If you are not using MySQL you will have to give us much more detail on your system.

          Comment

          Working...