Jump to content

[SOLVED] Includes and Loading pages into variables - '1's appearing


dominovision

Recommended Posts

Hi All,

 

Fairly new to php but not programming...

 

I want to load some php files into variables in the main page.. the files are pulled in ok,

however when echoing them out a '1' appears after each line. I think it might be returning a true as well? there are no '1''s in the included files. I want to load them into variables as will move to db driven pages afterwards. Any ideas?

 

See it in action at: www.royaldocks.net/bb/home.php

 

<?php

$headername = "component/header.php";
$footername = "component/footer.php";

/* Load all the files we need into variables then echo them out*/

  if(file_exists($headername)){
	/* go get it */
 $header =  require($headername);
}else{
	 $header =  "No Header";
}

if(file_exists($footername)){
	/* go get it */
 $footer =  require($footername);	
}else{
	 $footer =  "No Footer";
}


?>

<html>
<head>
</head>

<body>
<?php 
echo $header . "<br />";
echo "where are the nos coming from ?" . "<br />";
echo $footer . "<br />";

?>
</body>
</html>

 

 

Thanks Alastair

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.