Forum Moderators: coopster

Message Too Old, No Replies

require() displays contents of php file?

         

Neoguardian

6:10 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



Hey everyone,

New here.

I am having a problem with require/include parsing .php files. It works fine for html, but for some reason when I include .php files, the page displays my actual php code as plain text. Yet it also seems to execute said code after displaying it. Any help would be appreciated.

thanks,

-Michael

barns101

6:23 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



Does the file that you include contain start tags (<? or <?php)?

From [php.net...]

When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags.

Neoguardian

6:35 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



Thanks, Barns101. For some reason I thought I *had* included the proper php tags, but now I see I haven't. ID-10T error.

eelixduppy

7:55 pm on Sep 13, 2006 (gmt 0)



Welcome to WebmasterWorld, Neoguardian!

Glad you found the problem. ;)

Best of luck!