RE: RE: [PHP] Problems with require() and variables
| From: | Ford, Mike [LSS] | Date: | Thu, 16 Jan 2003 15:09:45 +0000 |
| Subject: | RE: RE: [PHP] Problems with require() and variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-131869@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: soazine@pop.erols.com [mailto:soazine@pop.erols.com]
> Sent: 16 January 2003 14:35
> To: m.ford@lmu.ac.uk
Copying this back to the list, in case anyone else can contribute (although I think the attachments
will be stripped -- can you make them available on a URL?).
>
> Ok, there they are, but they are quite large in size, I warn you.
>
> Basic concept is this:
>
> view.php: It will require display.php
> display.php: It will open a file (profile.xml), perform xml
> parsing into a
> 3-dim array of content, $profileArray
> view.php: will parse contents of $profileArray and display
> flagged profile
> set up by $profileArray[$index]
Yes, I understand (although no having used the XML functions, I can't vouvh for the validity of
your parsing strategy!).
>
> The problem is that $profileArray and $index both seem to vanish upon
> exiting the required code of display.php unless I store them
> in a session
> variable.
Well, as you're using old-style $HTTP_SESSION_VARS session variables, these should act
identically to any other variables in your script vis-a-vis the include file. And I can't see
any reason why your $profileArray shouldn't be exactly what you want it to be in view.php. So,
let's try a bit of simple debugging: what do you see if you put
echo '<pre>var_dump=';
var_dump($index, $profileArray[$index]);
echo "</pre>\n";
as the very last bit of PHP in display.php, and the same in view.php immediately after the include
statement (before the echo "4profileUserID...")? You should get identical results (even
if wrong ones!) -- if not, something *very* weird is happening.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211