Forum Moderators: coopster

Message Too Old, No Replies

Simple Code Block in HTML Page?

...does it have to be a .php?

         

Emperor

1:14 am on Apr 8, 2005 (gmt 0)

10+ Year Member



Hi guys,

Can I use a <script> tag or something similar to add a simple code block into an HTML page?

Or must the page be saved with the .php extension?

It would be cool if I could do it like I add some JavaScript.

Thanks.

HughMungus

1:49 am on Apr 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use an include.

include "somehtmlinafile.php";

Save it as anything you want, but, I make all my includes .php so no one else can read them by themselves.

HughMungus

2:07 am on Apr 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops. I thought you meant adding a block of HTML to a PHP page, not the other way around.

I'm sure someone else can answer this one. Probably with mod_rewrite.

H2O_aa

5:17 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



"Save it as anything you want, but, I make all my includes .php so no one else can read them by themselves."

Why would making the include.php not allow others to read them by themselves?

Emperor

5:55 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



"Why would making the include.php not allow others to read them by themselves?"

I think he means if you go to MySite.com/include.php you won't get a code dump in the browser window or even a Save As dialog box.