Re: Automatic Headers and Footers
| From: | Robert Cummings | Date: | Thu, 05 Jun 2003 22:48:54 +0000 |
| Subject: | Re: Automatic Headers and Footers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150424@lists.php.net to get a copy of this message | ||
Yes it can be done, using the auto-prepend feature call a script that
turns output buffering on. Then in the auto-appended script read the
buffer a manipulate ith with the automatic header and footer. Thus you
modify the content only and achieve what you want without modifying
the actual HTML file.
Cheers,
Rob.
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
Wendell Brown wrote:
>
> Ok guys, I think I have a challenge for you (actually, I don't think
> this can be done, but I've been proven wrong every time I've made that
> assumption with php in the past, so I'll ask anyway). Here's the
> question:
>
> Is there a way to have php insert headers and/or footers into all of
> the html files in a given directory on the fly (not actually modifying
> the files)? And by this I mean take an existing valid HTML file and
> add headers and footers and end up with a valid HTML file.
>
> Now, before some of you get trigger happy and tell me to read the
> manual and point me to things like .htaccess, auto_prepend_file, google
> and the like, think about what I'm really asking.... It needs to
> insert the header after the -body- tag and put the footer in before the
> -/body- tag. It needs to do this without modifications to the HTML
> file.
>
> And yes, I understand that by default HTML files aren't going to be
> effected by the auto_prepend_file (since they aren't php files) - so it
> will require adding HTML to the list of php parsed file types.
>
> For instance, the goal would be to take the following code:
>
> -HTML-
> -Head-
> -Title-This is a test-Title-
> -body-
>
> Well, did it work?
>
> -/body-
> -/html-
>
> and convert it to this:
>
> -HTML-
> -Head-
> -Title-This is a test-Title-
> -body-
> -h1-This is a page header-/h1-
>
> Well, did it work?
>
> -h3-This is the footer-/h3-
> -/body-
> -/html-
>
> Can it be done? I don't think so, but I leave it up to your wiles to
> suggest a solution....
>
> Thanks!!!