NYCPHP Meetup

NYPHP.org

[nycphp-talk] Includes

jessica kelly jkelly at sussex.cc.nj.us
Mon Sep 30 11:48:44 EDT 2002


So I could do this:

file called index.htm
(Contents of index.htm)
...
<body>
<!-- #include virtual="header.htm" ―>
<!-- #include virtual="menu.htm" ―>
Wonderful and Exciting Contents go here...
<!-- #include virtual="footer.htm" ―>
</body>
...

And it will be parsed by PHP....Right? (if I make the recommenced changes to the Apache conf file)

Will this work with the regular PHP installed or do I need mod_php??

Which would be better to use as to be less of a drain on server resources -  regular PHP or mod_php?

Jessica

>>> danielc at analysisandsolutions.com 9/30/02 11:14:01 AM >>>
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


--- Unsubscribe at http://nyphp.org/list ---







More information about the talk mailing list