Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Modify SubEthaEdit's mode/file extension mappings' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Modify SubEthaEdit's mode/file extension mappings
Authored by: seven5 on Jun 10, '04 11:29:03AM

i know you said not to ask why, but what about how? How the heck does your server parse the php, if its got .html on the extension? Did you tell it try to parse html as well? and if so, isn't that a bit inefficient?



[ Reply to This | # ]
Modify SubEthaEdit's mode/file extension mappings
Authored by: taran on Jun 10, '04 02:32:14PM
He could specify .html files to be handled by PHP within a specific virtual host or even only within a specific directory. I doubt that he's having all .html's server-wide handled by PHP. I've done this myself in the past for a couple of reasons:
  1. At the time I prefered seeing .html in the address bar - now I understand that the "average" computer user couldn't distinguish the address bar from Adam.
  2. Most forms I create have two PHP scripts - the form and the script that the form posts to - I use .phtml for scripts that build HTML pages and .php for scripts that only perform actions and pass the browser on to another page.


[ Reply to This | # ]
Modify SubEthaEdit's mode/file extension mappings
Authored by: bih on Jun 10, '04 09:29:37PM

On a per directory basis you can use .htaccess files and specify: "AddType application/x-httpd-php .html"

Yea, it would be a bit inefficient to parse all .html files for php code. I did it in a directory where I have forms and I have a weird naming obsession like 'form.html' for the form content and 'form.php' for the form processing.



[ Reply to This | # ]
Modify SubEthaEdit's mode/file extension mappings
Authored by: Thom on Jun 12, '04 03:43:57AM

Why the heck wouldn't you write a PHP page that both creates the form, and validates it as well? (e.g. posts it back to itself for error checking and submission.) That way, you've got the ability to re-generate the same form, filled out exactly the same way as the user filled it in a moment ago, except perhaps with red text on the column name where they failed validation, etc.

As far as the other suffix conventions -- I use .inc files for libraries of PHP code that are only to be included, never to be parsed as pages themselves, and I have a rule that prevents Apache from ever serving these pages directly. But other than .php, .php3 for legacy compatibility, or .html when I want to be sneaky... that's all I need, anyway.



[ Reply to This | # ]