Re: Setting title via included file
| From: | Chris | Date: | Wed, 21 Nov 2001 04:55:31 +0000 |
| Subject: | Re: Setting title via included file | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75351@lists.php.net to get a copy of this message | ||
[posted and mailed]
Jim Lucas addressed php.general and spake thusly:
>> I have a page that includes a file in the middle, but I wish to set
>> the title of the page based on a variable set in the included file--
>> is this possible?
>>
>> Basically, I was doing this for the output buffering:
>> ***
>> function fixtitle($buffer) { return (str_replace("XXX", $pagetitle,
>> $buffer));
>> }
>>
>> ob_start("fixtitle");
>>
>> ?>
>> <html>
>> <title>XXX</title>
>>
>> ...
>>
>> <? include("file_that_sets_pagetitle.inc") ?>
>>
>> ...
>>
>>
>> <?php
>>
>> ob_end_flush();
>>
>> ?>
> try it the other way around. capture the output of the included file
> before you send/display the title
I'm confused about how this would work. Could you clarify a little? My
understanding was that the callback function was called just before the
buffer was flushed. So, in this case it should get the $pagetitle from the
included file and apply it... but it doesn't appear to do this. I'm unclear
how to do this the other way around.
Thanks!
c