Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   PHP within HTML pages (https://www.cableforum.uk/board/showthread.php?t=16010)

Tricky 09-08-2004 21:50

PHP within HTML pages
 
Might be a daft question?:

Can I have a .htm or .html page with embedded php code?
I am currently trying to test this with some very basic code:

PHP Code:

<body>
<? echo("Hello"); ?>
</body>

This results in nothing on screen saved as a .htm or html but works on a .PHP save - this is on my own server but also on www.i-websolutions.co.uk

Either that or can someone confirm that .php pages will be indexed by search engines/robots/etc. including the follow links

Bifta 09-08-2004 22:01

Re: PHP within HTML pages
 
PHP code will only run if the file suffix indicates it's a PHP file, the same rule for SHTML and SSI. PHP files do however get indexed by search engines, certainly google indexes them.

Tricky 09-08-2004 22:04

Re: PHP within HTML pages
 
Cheers m8 - I'll stop pulling php.ini and httpd.conf in pieces now!
It was the indexing that I was bothered about - I am assuming that META tags in PHP files will be referenced in the same manner?

Bifta 09-08-2004 22:07

Re: PHP within HTML pages
 
Quote:

Originally Posted by Tricky
Cheers m8 - I'll stop pulling php.ini and httpd.conf in pieces now!
It was the indexing that I was bothered about - I am assuming that META tags in PHP files will be referenced in the same manner?

Yeah, there's no reason why they wouldn't be, the spider/engine will just read whatever client side code it can get at.

Richard M 09-08-2004 23:17

Re: PHP within HTML pages
 
Actually all you need to do is put this in a .htaccess file and upload it to the root of your public webspace:

AddType application/x-httpd-php .html .htm

Tricky 10-08-2004 10:30

Re: PHP within HTML pages
 
Quote:

Originally Posted by Richard M
Actually all you need to do is put this in a .htaccess file and upload it to the root of your public webspace:

AddType application/x-httpd-php .html .htm

Worked a treat - Excellent one m8


All times are GMT. The time now is 03:13.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum