Re: PHP Question regarding include()
| From: | Mattias Segerdahl | Date: | Wed, 29 Nov 2000 11:40:08 +0000 |
| Subject: | Re: PHP Question regarding include() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27804@lists.php.net to get a copy of this message | ||
Paul, you need to echo out the variable,
And you can't send variable like url's when including
Try this instead,
in main.php:
$headertitle="homepage";
$headersection="home";
include("header.php");
in header.php:
<title>Daniel's Website:<?=$headertitle; ?></title>
----- Original Message -----
From: "Paul Mullen" <pem@nellump.com>
To: <janda2@dingoblue.net.au>; <php-general@lists.php.net>
Sent: Wednesday, November 29, 2000 12:32 PM
Subject: Re: [PHP] PHP Question regarding include()
> >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>
>
> Your method doesn't work (as you found out). Someone else on the list can
> probably elaborate as to why.
>
> The contents of any included file are treated as if they were present in
> the including document itself. Therefore, you can simply assign values to
> the variables and then include the remote file:
>
> $headertitle = 'homepage';
> $headersection = 'home';
> include( 'header.php' );
>
> --
> 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
>
>