Re: standard coding...



"David Haynes" <david.haynes2@xxxxxxxxxxxx> wrote in message
news:OHrxf.4737$08.1779@xxxxxxxxxxxxxxxxxxxxxxxx
>d wrote:
>> Ideally speaking, any file that spits out html should have an .html
>> extension, as when the client sees it, it's HTML (regardless of how it
>> was created). As others have pointed out, that will require a minor
>> change in your server's configuration, but yields more professional
>> results.
>
> I'm not sure I agree with that. Isn't this a case of confusing naming with
> content? I know that, for reasons of speed, web servers like to tag
> content based on file suffixes, but I don't recall any of the standards
> bodies specifying it.
>
> Also, isn't a file that contains php a '.php'-suffixed file until it is
> processed and *then* becomes an HTML image? If so, the file doesn't 'spit
> out HTML' until it is preprocessed by php.

So the file, once spat out, should be called .html. Most web servers still
call php files .php even after they've been passed.

> AFAIK, the main reason for over-riding the .html extension to include php
> processing is so that the file displayed in the browser does not include
> the '.php' suffix and, therefore, does not tip off the end-user as to
> which preprocessing technology is being used. This was thought to be a
> security-related practice. It is similar to changing the '.do' suffix in
> struts to something else. (Security through obscurity.)

No, it's just a matter of having extensions matching the contents of the
file. I guess it's just being polite.

> There's nothing magical about any suffix - it's just what you tell the
> server to be sensitive to. For example, I could change all the php files
> to have a 'pre' suffix to indicate that these files are 'pre'processed
> before displaying them.

Unfortunately, as long as certain browsers take notice of suffixes, they are
somewhat magical. Making sure your extensions match your content is one
sure-fire way to get round that :)

> -david-

another david


.



Relevant Pages

  • Re: PHP-Yes, HTML-No --- Why?
    ... Because the files, when downloaded, are called .php and have absolutely no php in them:) ... But the extension doesn't match the contents of the file. ... Surely a dynamic web server should appear exactly the same as a static one - all files that contain HTML when viewed should be called .html. ...
    (comp.lang.php)
  • Re: standard coding...
    ... isn't a file that contains php a '.php'-suffixed file until it is processed and *then* becomes an HTML image? ... AFAIK, the main reason for over-riding the .html extension to include php processing is so that the file displayed in the browser does not include the '.php' suffix and, therefore, does not tip off the end-user as to which preprocessing technology is being used. ...
    (comp.lang.php)
  • Re: standard coding...
    ... I know that, for reasons of speed, web servers like to tag content based on file suffixes, but I don't recall any of the standards bodies specifying it. ... isn't a file that contains php a '.php'-suffixed file until it is processed and *then* becomes an HTML image? ... It is similar to changing the '.do' suffix in struts to something else. ...
    (comp.lang.php)
  • Re: PHP-Yes, HTML-No --- Why?
    ... I mean, the file doesn't contain php when the client gets it, so why should it be named .php? ... Surely a dynamic web server should appear exactly the same as a static one - all files that contain HTML when viewed should be called .html. ... There extension is not the only way to determine what's in a file. ...
    (comp.lang.php)
  • Re: Making one HTML page from more than one file
    ... In pure HTML no, but there exist several different mechanisms for doing ... odd compiler extension -- if you write code that uses the odd compiler ... Better yet would be to learn PHP, which really is a full-blown programming ...
    (alt.html)