Hey John,

> I've got the FAQ stuff done and on my end all is happy.  Check out
> www.dqsd.net/faq.htm and www.dqsd.net/faq.xml.

Looks good to me!


> My only thing is I still don't understand how to use the php to generate a
> new htm page from the xml page automatically (or is this something done on
> the fly by the browser by visiting www.dqsd.net/faq.php ?).


Well, you're sort of right -- the PHP page is what determines whether or not
to generate a new version of faq.htm.  The PHP script is run each time a
client's browser requests faq.php, but none of the processing happens in the
browser (client-side).  That's the major difference between a server side
language like PHP and a client side one like Javascript.

Basically, here's how my php script works:

The PHP script always returns the contents of the HTML file to the client,
so the faq link should point to "faq.php", not "faq.htm" or "faq.xml".  If
the HTML file is not out of date, the PHP script simply returns the contents
of the existing file.  If the HMTL file is out of date (i.e., when either
the XML or XSL files are newer than the HTML file), the PHP script will
rerun the stylesheet and generate a new html file, then (as always) return
the html file's contents.


The reason the HTML file is determined to be out of date" when it's older
than the XML or XSL source files is that if either the XML or XSL file is
newer, then modifications made to those files would affect the resulting
HTML.  The HTML file is ONLY considered "up to date" when it's timestamp is
newer than both the XML and XSL source files.


> Somehow the xml page is getting updated every day automatically,
> but the htm page still has the date I uploaded it.  But again, I
> don't really know what PHP is and how it works and I've been too
> busy lately trying to figure out how to use the timesync ocx in
> a js file to sync PC time.


Ah, okay.  PHP is a scripting language that's called as a middleman by the
webserver to generate the HTML output it will eventually serve to the
client.

Normally, when a client requests "page.html", it happens like this:

+--------+                                         +--------+
|        |                                         |        |
| CLIENT |   ===> REQUEST: Show me "faq.html" ===> | SERVER |
|        |                                         |        |
+--------+                                         +--------+
                                                       ||
                                                       ||
                                                  Find "faq.html"
                                                       ||
                                                       \/
+--------+                                         +--------+
|        |                                         |        |
| CLIENT | <== RESPONSE: Contents of"faq.html" <== | SERVER |
|        |                                         |        |
+--------+                                         +--------+



With PHP, the server doesn't return the contents of a file, it invokes the
PHP interpreter and passes it the request filename.  The PHP interpreter
finds that file and executes it as PHP code, which generates output.  The
webserver (e.g. Apache), returns that output as if it were the HTML contents
of the file the client requested.


+--------+                                         +--------+
|        |                                         |        |
| CLIENT |   ===> REQUEST: Show me "faq.php" ===>  | SERVER |
|        |                                         |        |
+--------+                                         +--------+
                                                       ||
                                                       ||
                                                  Show me "faq.php"
                                                       ||
                                                       \/
                                                   +--------+
                                                   |   PHP  |
                                                   | inter- |
                                                   | preter |
                                                   +--------+
                                                       ||
                                                       ||
                                                  Run "faq.php",
                                                  return output
                                                  to webserver
                                                       ||
                                                       ||
                                                       \/
+--------+                                         +--------+
|        |                                         |        |
| CLIENT | <=== RESPONSE: Output of"faq.php" <===  | SERVER |
|        |                                         |        |
+--------+                                         +--------+



does this clear things up?



Take care,

Nik



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel

Reply via email to