On Thu, 23 Sep 2004 16:25:27 +0100, Graham Cossey
<[EMAIL PROTECTED]> wrote:
> That's fine for static pages, my question was regarding dynamic pages that I
> did not wish to pass through the database querying again.
> 
> I understand that if my dynamic page is
> http://server/app/page1.php?cust=12345&t=3 I can supply that URL which will
> result in HTML that can be processed by (for example) pdf-o-matic. However,
> as I've already run all the queries necessary I would like to not have to
> run them all again when requesting the PDF.

At the beginning of your page1.php script (and any others that you
want to cache as html and pdf) you could check to see if you have
created cached version of the page, if so, redirect to that page. If
not, use output buffering and save the generated content to a file.
Run that file through the pdf-o-matic to create the pdf version. You
could name the file by creating a hash of the query string and any
other variable that affects the dynamic content of that page (for
example, session variables). So the original request might look like
your example.

http://server/app/page1.php?cust=12345&t=3

Which, if it has a cached html version would redirect to a different
URL before any of your queries are executed.

http://server/html/<hash-of-your-variables>.html

Or, for the pdf version.

http://server/pdf/<hash-of-your-variables>.pdf

- Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to