Page 2 of 2

Posted: Tue Feb 01, 2005 6:13 am
by SFADuncan
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?

Posted: Tue Feb 01, 2005 6:19 am
by JayBird

Code: Select all

if (empty($_SESSIONї'output'])) 
{ 
$_SESSIONї'output'] = $output; 
} 

$pwd = pathinfo(getcwd()); 
$directory = $pwdї'basename']; 
$output = $directory;

Posted: Tue Feb 01, 2005 6:27 am
by SFADuncan
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

Posted: Tue Feb 01, 2005 6:32 am
by JayBird
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'];

Posted: Tue Feb 01, 2005 6:41 am
by SFADuncan
The bit I want is the following after the URL... http://www.ealingcc.co.uk

so... I want one of the six directories isolated: home, about, cricket, etc

http://www.ealingcc.co.uk/[b]home[/b]/index.php

or

http://www.ealingcc.co.uk/[b]about[/b]/index.php

or

http://www.ealingcc.co.uk/[b]cricket[/b]/index.php

Simon

Posted: Tue Feb 01, 2005 6:49 am
by SFADuncan
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