Re: {include_php} and $PHP_SELF
| From: | Monte Ohrt | Date: | Tue, 12 Mar 2002 14:59:51 +0000 |
| Subject: | Re: {include_php} and $PHP_SELF | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3013@lists.php.net to get a copy of this message | ||
Did you try putting
global $PHP_SELF;
In your include_php script? That should work too, although using
$_SERVER['PHP_SELF'] is more efficient and secure. The problem is that
when you are in a template, your variable scope is within the smarty
function that displays the template. Try dumping the symbol table in
your script to see what variables you have available to you. I think the
function name is get_defined_vars().
Monte
Carsten Saathoff wrote:
>
> On Mon Mar 11 11:40:57 2002 CET Bertrand DUNOGIER wrote:
>
> > CS> I just used the built-in function {inlucde_php} and realized, that
> > CS> $PHP_SELF isn't defined in the included php script, although
> > CS> $_SERVER['PHP_SELF'] is available and points to the right place.
> >
> > the configuration variable register_globals is probably set to off on
> > the version of PHP you are running.
> >
> > if register_globals == on, $PHP_SELF is defined. if it is set to off,
> > $_SERVER['PHP_SELF'] is defined. It goes the same way for $_POST,
> > $_GET...
>
> Hi,
>
> Actually register_globals only influences user submitted data like
> $_GET, $_POST and $_SESSION, but $PHP_SELF is a php var and it should be
> always available. My server runs with register_globals=off and $PHP_SELF
> is available in all scripts except the script I included from a
> template.
>
> Is it possible, that the {include_php} overrides $PHP_SELF?
>
> On the other hand using $_SERVER['PHP_SELF'] is absolutely OK for me, I
> only wanted to know if I can rely on its availability ;).
>
> thanks
>
> Carsten
>
> --
> Carsten Saathoff ...powered by Linux ICQ #52558095
>
> The gods are great, I am the greatest!
> (Borknagar)
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
Director of Technology, ispi Inc.