Re: include (byname.php?lang=fr");
| From: | John Taylor-Johnston | Date: | Wed, 18 Feb 2004 21:41:14 +0000 |
| Subject: | Re: include (byname.php?lang=fr"); | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178175@lists.php.net to get a copy of this message | ||
Why didn't I think of that :) ?
Thanks John,
John
"John W. Holmes" wrote:
> 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...