Re: Noob - php works as .php but not when part of html
Geoff Berrow wrote:
[color=blue]
> I noticed that Message-ID: <nWYcd.686$ix2. 460@fe05.usenet server.com>
> from Data Goob contained the following:
>
>[color=green]
>>Well, now you've got my curiousity...
>>
>>Why is it a bad idea to intermingle PHP with HTML?[/color]
>
>
> I don't believe it is, necessarily.
>
> But by default the resultant file has to be named <something>.p hp
> whether it contains just raw php or a mixture of php and html.
>[/color]
Actually this is not true. I have several HTML files with PHP
embedded. In fact they are not only with embedded PHP the PHP
statement is a PHP include, and I have SSI's as well... with the
..html suffix.
<HTML>
blah blah blah...
<?php include 'my-embedded-calendar.php' ?>
more HTML...
</HTML>
So what it really boils down to is in getting Apache to see .html
as something that can be interpreted as/with PHP. As a purist,
this might seem a violation and comingling of two different things,
but for me it is hybridization and the ability to component-ize
my sites for easier maintenance. Is it right for all web work?
Probably not appropriate in all situations, and may even create
problems with other add-ons like templates, etc. I view templates
as hybridization anyway, so for me the discussion is purely
academic. Template integration reduces portability, so if this is
the intent, don't do non-portable PHP/SSI/HTML/TEMPLATES/ETC.
In the final analysis, it works beautifully for my sites...
<HTML>
blah blah blah...
<!--include virtual="my-included-banner.html-->
<?php include 'my-embedded-calendar.php' ?>
more HTML...
</HTML>
Regards,
-DG-
Geoff Berrow wrote:
[color=blue]
> I noticed that Message-ID: <nWYcd.686$ix2. 460@fe05.usenet server.com>
> from Data Goob contained the following:
>
>[color=green]
>>Well, now you've got my curiousity...
>>
>>Why is it a bad idea to intermingle PHP with HTML?[/color]
>
>
> I don't believe it is, necessarily.
>
> But by default the resultant file has to be named <something>.p hp
> whether it contains just raw php or a mixture of php and html.
>[/color]
Actually this is not true. I have several HTML files with PHP
embedded. In fact they are not only with embedded PHP the PHP
statement is a PHP include, and I have SSI's as well... with the
..html suffix.
<HTML>
blah blah blah...
<?php include 'my-embedded-calendar.php' ?>
more HTML...
</HTML>
So what it really boils down to is in getting Apache to see .html
as something that can be interpreted as/with PHP. As a purist,
this might seem a violation and comingling of two different things,
but for me it is hybridization and the ability to component-ize
my sites for easier maintenance. Is it right for all web work?
Probably not appropriate in all situations, and may even create
problems with other add-ons like templates, etc. I view templates
as hybridization anyway, so for me the discussion is purely
academic. Template integration reduces portability, so if this is
the intent, don't do non-portable PHP/SSI/HTML/TEMPLATES/ETC.
In the final analysis, it works beautifully for my sites...
<HTML>
blah blah blah...
<!--include virtual="my-included-banner.html-->
<?php include 'my-embedded-calendar.php' ?>
more HTML...
</HTML>
Regards,
-DG-
Comment