Re: include (byname.php?lang=fr");
| From: | John W. Holmes | Date: | Wed, 18 Feb 2004 18:35:56 +0000 |
| Subject: | Re: include (byname.php?lang=fr"); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178154@lists.php.net to get a copy of this message | ||
From: "John Taylor-Johnston" <taylorjo@collegesherbrooke.qc.ca>
> I want to create a language option, so the resulting html is in French or
English, depending. But passing variables like this doesn't work:
>
> <?php include ("../_phpcode/byname.php?lang=fr"); ?>
>
> echo $lang; // 'fr'
>
> Warning: main(): Failed opening '../_phpcode/byname.php?lang=fr'
> for inclusion (include_path='.:/usr/local/share/pear')
in
> /home/users/q/qx04t9mu/www/.../parnoms.htm on line 125
>
> It will work if I use a URL.
>
> <?php include
> ("http://foo.com/_phpcode/byname.php?lang=fr"); ?>
>
> echo $lang; // 'fr'
>
> Ideas on how to pass a variable?
include() code runs in the same scope as where you call include(). So you
can do this.
$lang = 'fr';
include('../_phpcode/byname.php');
and $lang will be available within the include file.
---John Holmes...