Compile php as a static binary (CGI execution mode?) and add something liek
the following to your code at the top:
$arg_count = 1;
while ($arg_count < count($argv))
$argument = $argv[$arg_count];
$arg_split = split("=",$argument);
$variable = trim($arg_split);
$value = trim($arg_split);
if ($variable != "" && $value != "") $$variable = $value;
$arg_count = $arg_count + 1;
Make catalog.php executable, then run it as such:
(assuming product_type and product_seq are the vars you use)
./catalog.php product_type=1 product_seq=2 > products.html
----- Original Message -----
From: Ron Stagg <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 2:18 PM
Subject: [PHP] **** Converting dynamic webpages into static HTML pages
I have an interesting challenge. I have built an online product catalog
that is driven entirely by the contents of the product database (MySQL).
The entire catalog is implemented in a single PHP script (catalog.php).
The dynamic nature of this implementation allows the catalog script to
generate hundreds of product description pages.
Now, my client has requested that I give him the ability to generate a
static version of the catalog so that he can burn it onto a CD for
distribution at trade shows. He wants the CD to be a snapshot of the
catalog. Furthermore, he wants to be able to generate this "snapshot"
frequently so that pricing info on the CD will be current. To
accommodate this, the process for generating the snapshot must be easy
My plan of attack is to generate static HTML files by running the
catalog script once for each product in the database. Here is my
quandary; instead of echoing the output to a buffer for Apache to send
off to the client, I need the script to output to a file. I do not want
to write a second version of catalog.php that writes everything to file.
There must be an easier way to do this. Is there a way I can access the
output buffer that Apache sends to the client?
Any other ideas?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php