Re: How do you read one of these parameters?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



trlists@xxxxxxxxxx wrote:
> On 11 Feb 2005 Richard Lynch wrote:
>
>> BAD: http://example.com/dynamic_pdf.php?record_id=1
>> GOOD: http://example.com/dynamic_pdf.php/record_id=1/fool_ie.pdf
>
> Just curious, how does IE screw up the first one?

I can describe the behaviour, pretty simply.

In some versions of IE (Mac IE 4.01 springs to mind) the first one will
NOT launch the PDF Reader application if you have configured it to not be
embedded in your browser.

So, pretty much, the link is just plain dead.

If you mean "how" in the sense of "how could MS write that code like
that?" I have *NO* idea...  I mean, it seems like they'd have to *work* at
it on purpose to screw up some of these dynamic media URL issues as badly
as they have.

As I've posted before, IE has so *MANY* problems with dynamic rich media
(PDF, images, FDF, MP3, Flash) etc, in so many different versions, that
I've simply given up trying to track all the versions/problems and now
follow a general guideline:

Craft a URL that Microsoft cannot possibly mistake for dynamic content.

So I don't even put the .php in the GOOD URL, and use a ForceType in
.htaccess instead to make 'dynamic_pdf' be a PHP script.

I've got a 'pathinfo.inc' that I just require in all my dynamic media
scripts which runs through $_SERVER['PATH_INFO'] and creates an array
$_PATH which, for the example given, would have:
$_PATH['record_id'] = 1;

For any path element that has no '=' in it, it gets tacked onto $PATH (no
underscore in front) with '/' separator.

So dynamic images have URLs and variables like:

http://example.com/image_script/filename.jpg
$PATH = '/filename.jpg'

http://example.com/img_script/artist_id=5/ellen_rosner/ellen_rosner.jpg
$_PATH['artist_id'] = 5;
$PATH = '/ellen_rosner/ellen_rosner.jpg';

I do the exact same thing for PDF, FDF, Ming(Flash), GD, etc.

Sometimes the $PATH part of the URL is not needed by my script, but is
just there to give IE the ".jpg" (or whatever) it's going to use to
determine what type of media it gets. (Ignoring the Content-type: I send
out)

It's very handy, very simple, and Microsoft can't possibly screw it up,
because there is no way they could know I don't have directories with
names like "artist_id=5" as the name of the directory.

Since I use it on all rich media, it's pretty well tested and it's just as
easy to type:
if (isset($_PATH['record_id']))
as it is to use $_REQUEST instead of $_PATH

It's also just as easy to $PATH as $_SERVER{'PHP_SELF']

I deal with a lot of dynamic rich media on a lot of different sites, and
so far, this plan has managed to keep my scripts compatible with all
versions of IE.  I still send out the HTTP spec headers of course, for
browsers that actually follow standards.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux