Re: PHP Question regarding include()
| From: | Marco Roccioletti | Date: | Wed, 29 Nov 2000 11:42:41 +0000 |
| Subject: | Re: PHP Question regarding include() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27805@lists.php.net to get a copy of this message | ||
On Wed, 29 Nov 2000, janda2@dingoblue.net.au wrote:
> I have been using PHP for a few weeks now and have found it very useful. I
> am in the process of rewriting my website using PHP.
>
> I have a index.php, which imports a header.php and footer.php. But I want
> to call header.php with some variables defined in index.php. i.e.
> "header.php?title=homepage".
>
> I current have:
> include("header.php?headertitle=homepage&headersection=home");
> in index.php. This is so each content page can set the title and 'section'
> for the header of each page.
>
> and in header.php
> <title>Daniel's Website:<? $headertitle ?></title>
>
> However when I load index.php in my web browser I get: Warning: Failed
> opening 'header.php?headertitle=homepage&headersection=home' for inclusion
> (include_path='.:/usr/local/lib/php') in
> /home/daniel/public_html/new/index.php on line 2
>
> I think I need to use another function, but due to the fact I am new to PHP
> I am not sure what that would be, any assistance would be appreciated.
>
> Thanks,
>
> Daniel.
Hi,
The included code "sees" the variables of the surrounding code, therefore you
can do:
$headertitle=homepage;
$headersection=home;
include("header.php");
Cheers,
Marco