Re: templates
| From: | Ernest E Vogelsinger | Date: | Tue, 19 Nov 2002 19:21:46 +0000 |
| Subject: | Re: templates | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125134@lists.php.net to get a copy of this message | ||
At 19:10 19.11.2002, Adam said:
--------------------[snip]--------------------
>Thanks, but not sure if this is what i'm looking for....
>
>I just want to setup the PHP script so that the variable $filename can be
>changed via a link such as 'index.php?filename="file.xml"',
>causing the script to parse the appropriate file.
--------------------[snip]--------------------
When you execute the URL
index.php?filename=file.xml
(note - no quotes)
your PHP script will have this value readily accessible as $filename (if
register_globals is on, as outlined in many threads the last days).
With the latest PHP versions, register_globals defaults to off, so you
don't have "$filename" but rather $_GET['filename'] available.
If your PHP host has register_globals off, but you need parameters as
globals, you can put this little script at the beginning of your PHP file:
foreach ($_REQUEST as $varname => $value) {
$var = '$'.$varname;
global $$var;
$$var = $value;
}
You will then be able to access parameters as if register_globals would be on.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/