Re: Creating an Entire .html page with PHP

From: Date: Sat, 30 Jan 2010 18:45:33 +0000
Subject: Re: Creating an Entire .html page with PHP
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-301699@lists.php.net to get a copy of this message
Ashley Sheridan wrote:
On Sat, 2010-01-30 at 13:40 -0500, Robert Cummings wrote:
Ashley Sheridan wrote:
On Sat, 2010-01-30 at 19:20 +0100, Nisse Engström wrote:
On Fri, 29 Jan 2010 14:48:47 +0000, Ashley Sheridan wrote:
On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote:
you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages..
You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower.
.htaccess: DirectoryIndex index.php /Nisse
That would only set the index for a given directory, it doesn't force Apache to run that script when something else is called.
I answered this issue yesterday with the following:
     AddType application/x-httpd-php .php .html .htm
I think tedd also adds .css :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP
I thought that doing that introduced slowdowns where Apache was parsing html files that didn't contain PHP code though?
It does... if your files don't have PHP. I imagine (but haven't checked) that you can set this on a virtual host basis. So then it becomes a question of utility versus wasted cycles. How many PHP sites actually bother to create .html files when there's no PHP code? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP

« previous php.general (#301699) next »