SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    generate "fresh" documents each time

    Hi,

    I've managed to generate PDF-reports with data from MySQL.
    In testing mode I've seen that when adjusting the PHP-script behind it, sometimes the PDF-doc doesn't change.
    It look likes it is being cached in some way?

    I've searched for freeing my page in cache, but the solution I've found works with headers and for generating the PDF, there may be no other output than the PDF-output...
    Some time ago I thought I've seen it be doing with some kind of unique "dummy-var" (like a session-var) in the URL, but I can't remember where anymore.

    Could something like this lead to a fresh document every time?

    Thank you very much for any suggestions!

    Sincerely,

    Ann

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. A similar technique is used by Flash developers to overcome the problem with Flash caching. You just use a function to append a random number to the end of your URL in a querystring and it's a "different" page every time as far as the browser is concerned. If you use a range of something like 1 to 1000, the chances of somebody getting the same number twice are pretty slim!

    Not very SE friendly though, if that might be an issue for you...


  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your reply, greg.harvey! That's all I need to start puzzling... ;-)

    Ann

  4. #4
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <a href="somepage.php?<?php time() ?>">...</a>

    or
    PHP Code:
    echo '<a href="somepage.php?'time(), '">...</a>'
    ?
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very very much for your reply, sweatje. It's very welcome... it's too hot to think these days ;-)

    Ann


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •