Forum Moderators: coopster

Message Too Old, No Replies

How do you "include" an external php file in html at run time?

         

nelsonm

2:17 am on Nov 26, 2010 (gmt 0)

10+ Year Member



Hi all,

The ASP style statement: <!--#include file="inc/meta.txt" --> allows you to include an external file into html at run time. I thought i could use it to include the contents of an external php file as well using... <!--#include file="scripts/file.php" -->

For some reason, it does not work...

Does anyone know how to "include" an external php file into html so its contents appear and execute at run time?

thanks,

nelsonm

5:07 am on Nov 26, 2010 (gmt 0)

10+ Year Member



ok, i think i figured out the following...

you can include either inline or external html in a .php file
but...
you can't include either inline or external php in a .shtml file.

topr8

9:20 am on Nov 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



the file type is on no importance for php!

but you need to configure apache to process the file as php.
so you could do it with .shtml files if apache is configured to parse them as php

nelsonm

10:04 am on Nov 26, 2010 (gmt 0)

10+ Year Member



thanks, i'll look into it.

g1smd

10:50 am on Nov 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use the AddType or AddHandler directives.

There's many previous threads with full details.