PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
SFADuncan
Forum Newbie
Posts: 23 Joined: Mon Aug 11, 2003 5:06 pm
Location: uk
Post
by SFADuncan » Tue Feb 01, 2005 6:13 am
So instead of:
Code: Select all
if (!session_is_registered("output"))
{
session_register("output");
}
$pwd = pathinfo(getcwd());
$directory = $pwdї'basename'];
$output = $directory;
I should do this?:
Code: Select all
if (!session_is_registered("output"))
{
$_SESSIONї'output'] = $output;
}
$pwd = pathinfo(getcwd());
$directory = $pwdї'basename'];
$output = $directory;
Or should this line:
Code: Select all
if (!session_is_registered("output"))
be changed too?
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Feb 01, 2005 6:19 am
Code: Select all
if (empty($_SESSIONї'output']))
{
$_SESSIONї'output'] = $output;
}
$pwd = pathinfo(getcwd());
$directory = $pwdї'basename'];
$output = $directory;
SFADuncan
Forum Newbie
Posts: 23 Joined: Mon Aug 11, 2003 5:06 pm
Location: uk
Post
by SFADuncan » Tue Feb 01, 2005 6:27 am
Yeah... my PHP book is a little out of date now... so, I've uploaded this and again, there appears to be an improvement... but I can still achieve this error, in spite of deleting all cookies of my system and starting again....
(BTW... I massively appreciate the advice and when I've solved this I'll be doing my penance by helping out in the less challenging HTML rooms!)
Simon
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Feb 01, 2005 6:32 am
i presume here you are trying to get the filename through $pwd['basename']
Code: Select all
$pwd = pathinfo(getcwd());
$directory = $pwdї'basename'];
$output = $directory;
But will that ever work???
getcwd() only returns the current dir, not including the filename, so $output aint set to anything as far as i can see.
If it is the dir you want, that line should be
Code: Select all
$directory = $pwdї'dirname'];
SFADuncan
Forum Newbie
Posts: 23 Joined: Mon Aug 11, 2003 5:06 pm
Location: uk
Post
by SFADuncan » Tue Feb 01, 2005 6:49 am
Substituting:
Code: Select all
$directory = $pwdї'dirname'];
for
Code: Select all
$directory = $pwdї'basename'];
...gives me permanent errors. The existing code must be working some of the time as I don't get the error on every click/link ?
Simon