NYCPHP Meetup

NYPHP.org

[nycphp-talk] Includes

Analysis & Solutions danielc at analysisandsolutions.com
Mon Sep 30 11:13:56 EDT 2002


Hi Jessica:

On Mon, Sep 30, 2002 at 10:56:06AM -0400, jessica kelly wrote:

> Is there a way to do includes for a Header, Footer and Menu with out
> using a .inc or .php extension?? I would rather see a .htm extensions 
> but what can I use to get Apache to parse the file?

If you're wondering about the extension on the included file, that doesn't 
matter.  PHP scripts will include the file regardless of what it's called 
and take appropriate action depending on the contents of the file.

If you're interested in the extension of the file doing the include, then 
you can change that behavior in your httpd.conf or .htaccess files with 
the following directive.  Tweak it as desired for your needs.

   AddType application/x-httpd-php .htm .inc .txt .php

But, do note, if your include files are in the document root (or a
subdirectory thereof), you'll want to make them get parsed as PHP anyway,
because you most likely don't want the source code getting revealed.  So,
put the extensions of your include files in the AddType directive, above.

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409



More information about the talk mailing list