RE: [PHP] Basic question (?php not working in html)
| From: | Christensen, BruceX R | Date: | Thu, 10 Aug 2000 17:08:53 +0000 |
| Subject: | RE: [PHP] Basic question (?php not working in html) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11183@lists.php.net to get a copy of this message | ||
The distinction here is between a file with a .html extension, and a file
with HTML markup tags in it. You can put HTML markup inside any file, with
any extension (which could be .html or .php or .thisisaweirdextension).
However, the web server (Apache) controls which files actually get parsed by
PHP. This is controlled by the AddHandler directive.
So... you can put PHP commands in a .html file, or HTML markup in a .php
file, but that doesn't force the web server to treat the file a specific
way. If you want a file to be parsed by PHP, make sure its extension is one
that appears on a line like this in httpd.conf (or .htaccess):
AddHandler application/x-httpd-php .yourextensionhere
Any file with the extension .yourextensionhere will be run through PHP, no
matter what type of content it contains.
If you have multiple extensions that you wish for PHP to process, do this:
AddHandler application/x-httpd-php .ext1 .ext2 (etc.)
You can put multiple extensions on the same AddHandler line.
--Bruce
Bruce Christensen
Intel Corporation
brucex.r.christensen@intel.com
-----Original Message-----
From: Ira Mica [mailto:iramica@yahoo.com]
Sent: Thursday, August 10, 2000 9:00 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Basic question (?php not working in html)
At 11:49 AM 8/10/00 -0400, Chad wrote:
>If you mean you are putting php into a .html file, no, it is not going to
>work, unless you tell Apache to parse .html files as php files. If you
need
>to use php in a file, do it in a .php file, not a .html file.
Chad.. you might be on to something.
From some tuturial on the web I got the following example:
<HTML><BODY><? PHP echo "Hello, Net" ?></BODY></HTML>
which gave me the impression that I can embed php code inside
html. And the http server would parse parts of the html page
as php and the rest as html, giving me a way to insert stuff
into the html page on the fly.
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net