Creating and listing posts

Discussion in 'PHP' started by Mackos, Sep 19, 2010.

  1. #1
    Hi!
    Guy's I have a simple question. I want to make something like CMS, and I want that post's will have an url: mysite.com/name_of_post or it can be just ID
    and can you tell me how to list them for example 9 post's on website, and if there will be 10th post, then fist one will go on 2nd site?

    Thanks ;)
     
    Mackos, Sep 19, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    If you are creating a CMS from scratch, you might want to consider if its quicker and/or easier to use one of the many open source platforms that are already available. What you are asking for is simple pagination; its not particularly hard to do but if this is a stumbling block for you, then you have a lot to do in order to build a fully functional CMS.

    Essentially, you want to SELECT your data limiting from your start to end rows.... its really that simple.

    SELECT (columns) FROM (table) WHERE (conditions) LIMIT x,y
    Code (markup):
    You will have to pay attention to count the number of pages available if you want a navbar, and only display a certain number at a time. There are a LOT of tutorials that detail how to paginate results already online; see here as an example;

    http://www.phpfreaks.com/tutorial/basic-pagination


    As mentioned above, however, You might want to consider wordpress as an alternative; http://wordpress.org
     
    lukeg32, Sep 20, 2010 IP