Re: cannot access inc files from a function
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: cannot access inc files from a function

From: <bettina@coaster.ch>
Date: Fri Jul 29 2005 - 16:08:45 CEST

Hi DXTrim,

the values are really there since I use the references outside the
function and it work ok. I think it has something to do with what says
Giannis regarding the global variable. I'll try that. Thank you.

DXTrim schrieb:

> Hallo Bettina,
>
> What is the exact name of the file you are trying to include. Your construct
> is very weird, if the file is "lang.EN.inc.php" for example, try:
>
> require("lang.$lang.inc.php");
>
> Also, could you post the code of that included file so we can see if the
> values are really there.
>
> Hope this helps,
>
> DXTrim
>
>
> <bettina@coaster.ch> wrote in message
> news:1122642564.772775.241500@g49g2000cwa.googlegroups.com...
> > I have the following piece of code (symplified)
> >
> > require("lang.{$lang}.inc.php"); // I include the inc. files
> > ...
> > function decodify($technique) { // functions that give me back the
> > value in inc.file
> > switch ($technique) {
> > case 'C':
> > echo $charcoal;
> > break;
> > case 'O':
> > echo $oil;
> > break;
> > case 'A':
> > echo $acrylic;
> > break;
> > }
> > }
> > ....
> > Somewhere I call the function ....decodify($myTechnique)
> >
> > But it doen't print the content from $charcoal, $oil or, etc.
> > Do I have to declare the function global or something like that. In
> > that case, how should I do it??
> > Many thanks. Bettina
> >
Received on Mon Oct 17 21:22:37 2005