PDA

View Full Version : return statement question


JonnyNoog
10-05-2005, 02:06 AM
Hello,

I am trying to create a custom search results template for my site. I have found and read this thread (http://www.phpdig.net/forum/showthread.php?threadid=348) and have successfully made the changes required up to the point where everything seems to be working except that I am getting some unexpected "1" characters displayed. From reading the before mentioned thread I gather this problem can be solved by implementing return() but am unsure how to do this. I am something of a php noob so sorry if this is an inane question but any assistance would be greatly appreciated.

Charter
10-05-2005, 06:41 AM
Assuming you are wanting to include a PHP header and footer, make the PHP files like so, sticking the HTML content into a variable, and then returning that variable:

<?php

$my_header = <<<END
<html>
<body>
<!-- and so forth -->
END;

return $my_header;

?>

JonnyNoog
10-05-2005, 05:35 PM
Thanks for that Charter, I knew it was an easy fix but just couldn't fit the final puzzle piece. Now I just have to modify the rest of my pages to use the same variable for the includes :).