Re: Setting title via included file
| From: | Jim Lucas | Date: | Tue, 20 Nov 2001 23:47:19 +0000 |
| Subject: | Re: Setting title via included file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75327@lists.php.net to get a copy of this message | ||
try it the other way around. capture the output of the included file before
you send/display the title
Jim
----- Original Message -----
From: "Chris Lott" <chrisl@thethirdsector.com>
To: <php-general@lists.php.net>
Sent: Tuesday, November 20, 2001 3:44 PM
Subject: [PHP] Setting title via included file
> 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?
>
> PHP processes the page sequentially, so if I have $foo = Title in the
> included file, it is too late to use it for the title of the main
document.
>
> I thought output buffering might be the key, but it doesn't seem to work.
> Should it?
>
> 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();
>
> ?>
>
>
> c
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>