> Dave just told me that PHP has been installed on the web server!
>
> http://www.dqsd.net/test.php
>
> Nik,
>
> If you can write some PHP script to do the transform (faq.php?) and spit out
> the faq, that would be great.


Hey Glenn,

The PHP script I attached to my email on friday should work.

Here it is again so you don't have to hunt for it:



<?php  // FAQ.php -- simple caching for DQSD HTML FAQ
// This script assumes that the XSLT extension is enabled in PHP
// and that the PHP version is 4.0.6 or newer.
// The xslt_process function for older versions used different parameters
// and is incompatible with the new function declaration.


// change these to the correct filenames.
$xsl_filename  = "faq.xsl";
$xml_filename  = "faq.xml";
$html_filename = "faq.html";



// shouldn't have to modify anything below this line


$html_timestamp = filemtime($html_filename); // avoid calling twice

if (($html_timestamp < filemtime($xsl_filename)) ||
    ($html_timestamp < filemtime($xml_filename)))
{
   $xh = xslt_create();
   if(! @xslt_process($xh, $xml_filename, $xsl_filename, $html_filename))
   {
       // error in xslt_process!  Write the error to the HTML file
       // so that it will be displayed instead of the old FAQ.
       // This is, of course, totally unnecessary, but might help
       // debug problems while writing the XML and/or XSL files.

       $fp = fopen($html_filename, 'w');
       fwrite($fp, "Error processing stylesheet: " . xslt_error($xh));
       fclose($fp);
   }
}

// HTML file has, if outdated, been rewritten.  Now just echo the
// contents to the client.
if(version_compare(php_version(), "4.3.0", ">="))
{
   echo file_get_contents($html_filename);
}
else
{
   echo implode('', file($html_filename));
}

?>



hth,

Nik



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel

Reply via email to