PDA

View Full Version : $header template question ...



Gordon Werner
Thu 18th Jan '01, 12:41am
folks I am hopefully someone here can assist me.

I am trying to have the header template include the same header file that I use on the rest of my site.

If I put:

include('include/header.php');

in the header template, the code looks like it should in my web browser. However, when I view the source it seems that instead of inserting the code below the <BODY> tag, it has inserted it at the very top of the page ... even before the DTD declaration.

Alternately, if I make all the code in the include file the value of the variable $header, ( i.e. $header = "all html, php stuff here"; ) then the code shows up in the correct space, but it wont let me include any other files from that one.

Does anyone know what I might be doing incorrectly? I can't seem to figure out why the code shows up above the <HTML> tag, etc ...

any and all help is most appreciated. Feel free to email me if you need any specific information.

Thanks

Gordon
gwerner@nwlink.com

Mike Sullivan
Thu 18th Jan '01, 12:44am
$header = implode('', file("http://www.domain.com/include/file.php"));

is the easiest way to explain.

Gordon Werner
Thu 18th Jan '01, 12:54am
ok ... I tried what you suggested and what was displayed was very odd ... while the code was located in the right place, it looks like the PHP code was not parsed (lots of echo statements and the like displayed)

$header = implode('',file("include/header.php"));

is what I entered.

Any idea?

thanks

gordon

Mike Sullivan
Thu 18th Jan '01, 1:04am
As I said, you need the http:// part.

Or if you have PHP4 you can use output buffering. Search for ob_start.

Gordon Werner
Thu 18th Jan '01, 2:59am
Thanks for the pointer ... I got it working correctly now

Appreciate the assistance.

gordon