Update a static page if created before a certain time when someone requests the page?

Discussion in 'PHP' started by ched, Mar 30, 2010.

  1. #1
    I have a mysql driven site where the database is only updated twice each day. I am on a shared server and having 'db connection issues' when I get reasonable traffic.

    So I would like to be able to create static versions of most of my pages but I would like a way to check if the static version was created before a certain time. If it was then to overwrite the static page with a new one.

    I hope that makes sense. Basically I would like to automatically update my 'static' pages if they were created before a certain time when someone requests a page.

    Any ideas?

    Thanks.
     
    ched, Mar 30, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    PHP: filemtime() and then just use the math functions to compare against time() or date().
     
    krsix, Mar 30, 2010 IP
  3. ched

    ched Active Member

    Messages:
    185
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #3
    krsix: thanks for that. I have the time bit sorted now. So all I have to do now is create a new include file if the current one is too old. :) I think you have helped me find the solution. Thanks.
     
    ched, Mar 30, 2010 IP
  4. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    no prob mate, enjoy :)
     
    krsix, Mar 30, 2010 IP