PHP Webmaster <mailto:[EMAIL PROTECTED]>
on Tuesday, October 21, 2003 4:17 AM said:
> The required file will be changing all the time, that's why I want
> to set the title in the individual pages and get the main page to
> read that information.
in that case let me revise my original code.
ORIGINAL:
>> <?php
>>
>> $title = "page title";
>>
>>
>> include "header.php";
>>
>> echo "<p>Welcome to the home page of our website.</p>\n"
>> ."<p>Blah, blah and more blah!</p>\n";
>>
>> include "footer.php";
>>
>> ?>
NEW AND IMPROVED:
<?php
include "main.php";
include "header.php";
echo Main_PHP();
include "footer.php";
?>
main.php:
<?php
$page_title = "the page!";
function Main_PHP
{
$output = "<p>Welcome to the home page of our website.</p>\n";
$output .= "<p>Blah, blah and more blah!</p>\n";
return $output;
}
?>
Instead of assigning everything to a variable and returning it you could
echo ""; everything, OR I think you can turn on output buffering and
then capture the buffer and then return that.
I should also mention that I used to do what you originally presented
when I wrote ASP. It was real easy with ASP because there is a
"function" called Sub. It's not really a function in that it performs a
task, but it was more like defining an include without including an
entire file.
I also ran into a few problems with that method because it prevented me
from designing the infrastructure of the site in the way I wanted to. I
don't remember any specifics about that though. ;)
Chris.
p.s. Please take note of my sig. Version 0.80 is the best.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php