[PHP] Robustly using XSLT across different versions of PHP?

2005-04-20 Thread D. D. Brierton
Has anyone written anything, perhaps in PEAR or elsewhere, that allows for
some portability of XSLT use across PHP 4 with Sablotron, PHP 4 with
domxml, and PHP 5?

I'm doing some work on a project at the moment, and the server it will be
hosted on initially has PHP 4 compiled with Sablotron support.
Unfortunately my workstation where I'm doing a lot of prototyping runs
Fedora Core 3 and has PHP 4.3.11 compiled with '--with-xml'
'--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr'
'--with-dom-exslt=/usr'. All attempts so far to recompile Fedora's src rpm
with sablotron have failed and frankly I've given up. Besides which, it's
likely that at some we'll want to start using PHP 5. I can use the domxml
XSLT support in PHP 4 on my FC3 box just fine, e.g. like this:

?php
$filename = default.xsl;
$xmldoc = domxml_open_file(control.xml);
$xsldoc = domxml_xslt_stylesheet_file($filename);
$result =  $xsldoc-process($xmldoc);
echo $xsldoc-result_dump_mem($result);   
?

but that isn't too much help given that that doesn't work on the
production server.

Has anyone done any work on creating something like PEAR:DB which will
use the functions described here:

http://uk.php.net/manual/en/ref.domxml.php
http://uk.php.net/manual/en/ref.xslt.php
http://uk.php.net/manual/en/ref.xsl.php

depending on their availability?

TIA.

Best, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
   Trying is the first step towards failure (Homer Simpson)
==

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



[PHP] What else can cause unexpected T_SL error other than heredoc?

2004-11-25 Thread D. D. Brierton
We've been getting the following error:

[error] PHP Parse error:  parse error, unexpected T_SL in
/foo/bar.php on line 136

(where foo and bar obviously are stand-ins for real values).

The weird thing is that the file generating the error, bar.php, DOESN'T
contain any heredoc quotations. bar.php was being called by another file,
let's call it baz.php with require_once, and baz.php was also calling
other files using require_once which DID include heredoc quotations, let's
call them heredoc1.php and heredoc2.php. I was able to determine that the
problem was indeed caused by bar.php, and not by anything in heredoc1.php
or heredoc2.php by testing in the following way:

Testing baz.php with the the following commented out:

require_once 'bar.php';
// require_once 'heredoc1.php';
// require_once 'heredoc2.php';

Then testing baz.php with the following commented out:

// require_once 'bar.php';
require_once 'heredoc1.php';
require_once 'heredoc2.php';

In the first test the unexpected T_SL error persisted, whereas in the
second it went away.

But, bar.php does NOT contain any heredoc quoted strings, nor does it
contain anywhere the strings  or . So what could be the cause of
the T_SL error?

This is PHP 4.3.8 on Linux kernel 2.4.20 and Apache 1.3.31.

TIA, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
   Trying is the first step towards failure (Homer Simpson)
==

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



Re: [PHP] What else can cause unexpected T_SL error other than heredoc?

2004-11-25 Thread D. D. Brierton
On Thu, 25 Nov 2004 06:26:22 -0600, Greg Donald wrote:

 On Thu, 25 Nov 2004 12:17:01 +, D. D. Brierton [EMAIL PROTECTED] wrote:
 We've been getting the following error:
 
 [error] PHP Parse error:  parse error, unexpected T_SL in
 /foo/bar.php on line 136
 
 Can you post some of this code?  Are all your heredoc instances
 completely left justified?

Okay, from baz.php:

// load environment settings
require_once '../common/re5ult_settings.php'; // bar.php in my example
require_once '../common/re5ult_utils.php';// heredoc1.php
require_once '../common/re5ult_xml.php';  // heredoc2.php

All of the heredoc instances were fine (as I think demonstrated by
commenting out the reference to re5ult_settings.php but NOT to the files
which contain the heredoc instances). Here is an example of one of them:

echo EOMSG

/td
/tr
/table
/body
/html
EOMSG;


 But, bar.php does NOT contain any heredoc quoted strings, nor does it
 contain anywhere the strings  or . So what could be the cause of
 the T_SL error?
 
 I dunno if that's just a typo in your post, but heredoc requires 3 
 or , not two as you wrote.

My point being that the file that certainly appears to be causing the
problem doesn't contain the string  or  and therefore nor does it
contain  or .

 Are you using any sort of PHP cache by chance?

No.

Thanks for helping.

Best, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
   Trying is the first step towards failure (Homer Simpson)
==

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



Re: [PHP] How to simultaneously send HTML *and* start download?

2002-05-22 Thread D. D. Brierton

Following on from my mail yesterday, here are the results of testing
Billy's multipart content method on Windows browsers (Windows 98 to be
precise):

* IE 6.0 displays the boundary markers and content-type headers
  inline and also the contents of myfile.foo instead of saving
  it to disk.
* Netscape 6.2.2 displays the HTML correctly and prompts
  regarding whether myfile.foo should be saved to disk but then
  appears to do nothing.
* Netscape 4.7 displays the HTML correctly and begins
  downloading the file, only prompting for where it should be
  saved when the download is complete.
* Opera 6.0 displays the HTMl correctly and prompts for where
  you wish to save the file, but incorrectly uses the script
  name and not the file name as specified in the
  content-disposition header.

(It is possible that the behaviour of both Netscape 4.7 and Netscape
6.2.2 was in part due to interaction with Norton Anti-Virus.)

Hope this is informative and not spam.

Best, Darren

On Tue, 2002-05-21 at 21:02, Billy S Halsey wrote:
 Hi,
 
 Here's the shell of a script I wrote a while back to do exactly what you 
 want:
 
 ?php
 
 header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\);
 
 print ---Boundary-12399\r\n;
 print Content-Type: text/html\r\n;
 print \r\n;
 
 // Your HTML code goes here
 
 print \n;
 print ---Boundary-12399\r\n;
 print Content-Type: application/octet-stream\r\n;
 print Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n;
 readfile(./foo.tar.gz);
 
 print ---Boundary-12399--\r\n;
 print \r\n;
 
 ?
 
 
 Note the format of the Boundary headers, especially the dashes.

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
==

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




[PHP] How to simultaneously send HTML *and* start download?

2002-05-21 Thread D. D. Brierton

The result I'm looking for is like the CGI script at netscape for downloading
NS6 - it takes you to a page which says aomething like The download should
start automatically and then the download begins. I'm having trouble figuring
out how to do this in PHP - I suspect through ignorance of the appropriate
HTTP headers. Am I looking for something like Content-type: multipart? So what
I'm looking to achieve is a bit like what this obviously fails to do (but
hopefuly you can see what I'm aiming at):

?php
  $fp = fopen(myfile.foo,r);
  header(Content-type: application/foo);
  header(Content-Disposition: filename=myfile.foo);
  fpassthru($fp);
  fclose($fp);
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  http://www.w3.org/TR/html4/loose.dtd;
html
  head
titleDownload/title
  /head
  body
pThe download should start automatically. If it does not, right click
the following link and choose Save as .../p
pa href=myfile.fooDownload MyFile/a/p
  /body
/html

Obviously what actually happens with the above is that the HTML after the PHP
script is appended to myfile.foo.

Can anyone point me in the right direction?

TIA, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
==

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




Re: [PHP] How to simultaneously send HTML *and* start download?

2002-05-21 Thread D. D. Brierton

On Tue, 21 May 2002 20:57:46 +0100, 1lt John W. Holmes wrote:

 Use PHP to write a META-REFRESH to the file that's going to be downloaded,
 or a php file that controls the download. Basically, you show them an HTML
 page that says the download will begin, the META tag refreshes after X
 seconds to the actual file, and the download box pops up.

Oh, okay. I was obviously overlooking the simple solution. But, just out of
curiousity, does that mean that you *can't* do what I was at first trying to
do - that is use PHP to send a file and some HTML as some kind of multipart
content to a browser?

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
==

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




Re: [PHP] How to simultaneously send HTML *and* start download?

2002-05-21 Thread D. D. Brierton

On Tue, 2002-05-21 at 21:02, Billy S Halsey wrote:
 Here's the shell of a script I wrote a while back to do exactly what you 
 want:

Thanks, Billy! That's really helpful. I'm curious as to the significance
of the number 12399. Is this just a random number used as a separator,
or does it indicate the length of one of the parts? (In other words
should I alter the boundary marker to reflect the content I'm sending?)

 ?php
 
 header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\);
 
 print ---Boundary-12399\r\n;
 print Content-Type: text/html\r\n;
 print \r\n;
 
 // Your HTML code goes here
 
 print \n;
 print ---Boundary-12399\r\n;
 print Content-Type: application/octet-stream\r\n;
 print Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n;
 readfile(./foo.tar.gz);
 
 print ---Boundary-12399--\r\n;
 print \r\n;
 
 ?
 
 
 Note the format of the Boundary headers, especially the dashes.

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
==

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




Re: [PHP] How to simultaneously send HTML *and* start download?

2002-05-21 Thread D. D. Brierton

I just thought that members of this list following this thread might
like to know the results of my experimenting with this technique:

All tests on Linux (testing on Windows 98 tomorrow):

* Mozilla 0.9.9 worked perfectly.
* Netscape 4.78 appeared to work but downloaded file was very
  slightly larger than original (can't tell if that's a problem
  because it's a Windows binary).
* Konqueror 2.2.1 downloaded the binary, but opened a file save
  as dialog defaulted to the script name not the name in
  Content-Disposition, and failed to display the HTML.
* Opera 5.05 (don't have 6.0 yet) crashes instantly and crashes
  X with it!

I'll let you know (if you're interested) the results of testing on
Windows tomorrow. Look like it might have to be the meta http-equiv
refresh technique after all (although I'm worried about the browser
attempting to display the file instead of saving it with that
technique).

Thank to everyone for their help.

Best, Darren

On Tue, 2002-05-21 at 21:02, Billy S Halsey wrote:
 Hi,
 
 Here's the shell of a script I wrote a while back to do exactly what you 
 want:
 
 ?php
 
 header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\);
 
 print ---Boundary-12399\r\n;
 print Content-Type: text/html\r\n;
 print \r\n;
 
 // Your HTML code goes here
 
 print \n;
 print ---Boundary-12399\r\n;
 print Content-Type: application/octet-stream\r\n;
 print Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n;
 readfile(./foo.tar.gz);
 
 print ---Boundary-12399--\r\n;
 print \r\n;
 
 ?
 
 
 Note the format of the Boundary headers, especially the dashes.

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
==

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