Jump to content

Recommended Posts

Posted

If you look under apache handlers you see that SHTML pages are capable of hadling Includes (which is how I do mine). You can also set it up so that .html and .htm pages can handle includes. Is there a down side to doing this? It sure seems easy to stick with html instead of PHP or SHTML.

Posted

Don't know if there is a downside. I thought I read a while back on the forums that someone couldn't mix SHTML and PHP. However you can use PHP includes to do everything you are doing now and it works in HTML files just fine.

Posted
If you look under apache handlers you see that SHTML pages are capable of hadling Includes (which is how I do mine).  You can also set it up so that .html and .htm pages can handle includes.  Is there a down side to doing this?  It sure seems easy to stick with html instead of PHP or SHTML.

The Apache manual recommends against configuring the server to parse .html and .htm pages for server-side includes:

...by doing this, you're requiring that Apache read through every single file that it sends out to clients, even if they don't contain any SSI directives. This can slow things down quite a bit, and is not a good idea.

What is recommended instead is to use the XBitHack directive in your .htaccess file:

>XBitHack on

With XBitHack enabled in your .htaccess file, you can have specific .html pages parsed for server-side includes by setting the permissions on those files to be executable.

Posted

Sorry, missed one critical piece of information. For PHP to be parsed in HTML pages you need to add this to your .htaccess file.

 

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

Posted
Sorry, missed one critical piece of information.  For PHP to be parsed in HTML pages you need to add this to your .htaccess file.

 

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

OK I added the code to my .htaccess file, and now instead of getting nothing I get errors.

Any Ideas?

Posted

I use Bruces method above

as all my html pages are made up of php includes.

I also added shtml to the list so my error pages can use php.

However SSI will no longer work in the error pages,

but I do not care as I use php instead.

Posted (edited)

I have tried it all of the following ways

><body>
include $_SERVER['DOCUMENT_ROOT']."/pool/top.php"
<!--#include file="/pool/top.php" -->
<?php include("/pool/top.php"); ?>
<!--#include virtual="/pool/top.php" -->

</body>

no luck

Edited by wampthing

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...