1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Rotating content script

Discussion in 'Programming' started by eddie, Jul 2, 2005.

  1. #1
    I have a bunch of articles i have written over the years and would like to add them to a bunch of DB generated pages.
    I would like them to rotate if possible after 5 to 10 page loads.
    would use a php include in footer file.
    articles are in Html
    Thanks
     
    eddie, Jul 2, 2005 IP
  2. JoeO

    JoeO Peon

    Messages:
    431
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That seems simple enough. Just set a cookie with a counter that goes up every time the page refreshes. Everytime the counter is divisable by 5 or 10 or whatever increase the article ID by 1.
     
    JoeO, Jul 2, 2005 IP
  3. honey

    honey Prominent Member

    Messages:
    15,555
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #3
    or just use the PHO random function. Works pretty well.
     
    honey, Jul 3, 2005 IP
  4. Juls

    Juls Well-Known Member

    Messages:
    1,867
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    170
    #4
    PHO random function? PHP? the random function would randomize the article upon each load and not every 5 or so loads.

    i would add to both suggestions, you will need a counter but it cant be cookie based as it will only rotate after every 5 loads per visitor and not every 5 loads from all visitors.

    Use a text based counter or mysql db. with the random function to select the next article. You could also use the db to store which articles have been shown so that you can make sure that your articles get shown in a particular order.

    :)

    good luck.
     
    Juls, Jul 3, 2005 IP