Connecting Tech Pros Worldwide Help | Site Map

DEFAULT_FOLDER ?

Tony B
Guest
 
Posts: n/a
#1: Jul 11 '08
I'm trying to understand some code on a php site I'm looking at.
Each page in the site has a require('filenames.php'); statement in the
header.
filenames.php has typical entries like
define('FILE_INDEX',DEFAULT_FOLDER .'index.php');

php warns that DEFAULT_FOLDER is unknown with a message like
Use of undefined constant DEFAULT_FOLDER - assumed 'DEFAULT_FOLDER' in
filenames.php on line 2

What is DEFAULT_FOLDER ? I searched uk.php.net and couldn't find a reference
to this variable ?


Jeff
Guest
 
Posts: n/a
#2: Jul 11 '08

re: DEFAULT_FOLDER ?


Tony B wrote:
Quote:
I'm trying to understand some code on a php site I'm looking at.
Each page in the site has a require('filenames.php'); statement in the
header.
filenames.php has typical entries like
define('FILE_INDEX',DEFAULT_FOLDER .'index.php');
>
php warns that DEFAULT_FOLDER is unknown with a message like
Use of undefined constant DEFAULT_FOLDER - assumed 'DEFAULT_FOLDER' in
filenames.php on line 2
>
What is DEFAULT_FOLDER ? I searched uk.php.net and couldn't find a reference
to this variable ?
Well, it is not defined, obviously. You'll need to define it the same
way as FILE_INDEX.

Check "define" in the PHP docs and "constant". The DEFAULTS_FOLDER is
a constant whose define is missing in your code.

Jeff
Quote:
>
>
Tony B
Guest
 
Posts: n/a
#3: Jul 11 '08

re: DEFAULT_FOLDER ?


"Jeff" <jeff@spam_me_not.comwrote in message
news:5q-dnUvxO9YZs-rVnZ2dnUVZ_jadnZ2d@earthlink.com...
Quote:
Tony B wrote:
Quote:
>I'm trying to understand some code on a php site I'm looking at.
>Each page in the site has a require('filenames.php'); statement in the
>header.
>filenames.php has typical entries like
> define('FILE_INDEX',DEFAULT_FOLDER .'index.php');
>>
>php warns that DEFAULT_FOLDER is unknown with a message like
>Use of undefined constant DEFAULT_FOLDER - assumed 'DEFAULT_FOLDER' in
>filenames.php on line 2
>>
>What is DEFAULT_FOLDER ? I searched uk.php.net and couldn't find a
>reference to this variable ?
>
Well, it is not defined, obviously. You'll need to define it the same way
as FILE_INDEX.
>
Check "define" in the PHP docs and "constant". The DEFAULTS_FOLDER is a
constant whose define is missing in your code.
>
Jeff
>
I didn't write the code, but was just trying to understand it. I assumed
that default_folder must be some sort of php defined variable, which it
doesn't seem to be. I guess whoever wrote the code never used the defines
since they don't make sense. My guess is maybe DEFAULT_FOLDER is supposed to
be defined as the site root folder path as then FILE_INDEX would point to
the main home page ?
Tony


sathyashrayan
Guest
 
Posts: n/a
#4: Jul 11 '08

re: DEFAULT_FOLDER ?



"Tony B" <tagb61@yahoo.co.ukwrote in message
news:qjGdk.230447$Ev5.197150@fe09.news.easynews.co m...
Quote:
"Jeff" <jeff@spam_me_not.comwrote in message
news:5q-dnUvxO9YZs-rVnZ2dnUVZ_jadnZ2d@earthlink.com...
Quote:
>Tony B wrote:
Quote:
>>I'm trying to understand some code on a php site I'm looking at.
>>Each page in the site has a require('filenames.php'); statement in the
>>header.
>>filenames.php has typical entries like
>> define('FILE_INDEX',DEFAULT_FOLDER .'index.php');
>>>
>>php warns that DEFAULT_FOLDER is unknown with a message like
>>Use of undefined constant DEFAULT_FOLDER - assumed 'DEFAULT_FOLDER' in
>>filenames.php on line 2
>>>
>>What is DEFAULT_FOLDER ? I searched uk.php.net and couldn't find a
>>reference to this variable ?
>>
>Well, it is not defined, obviously. You'll need to define it the same way
>as FILE_INDEX.
>>
> Check "define" in the PHP docs and "constant". The DEFAULTS_FOLDER is a
>constant whose define is missing in your code.
>>
> Jeff
>>
I didn't write the code, but was just trying to understand it. I assumed
that default_folder must be some sort of php defined variable, which it
doesn't seem to be. I guess whoever wrote the code never used the defines
since they don't make sense. My guess is maybe DEFAULT_FOLDER is supposed
to be defined as the site root folder path as then FILE_INDEX would point
to the main home page ?
Tony
>
Those defines might be in a config.php or in the include folder.

Quote:
>

Jeff
Guest
 
Posts: n/a
#5: Jul 11 '08

re: DEFAULT_FOLDER ?


Tony B wrote:
Quote:
"Jeff" <jeff@spam_me_not.comwrote in message
news:5q-dnUvxO9YZs-rVnZ2dnUVZ_jadnZ2d@earthlink.com...
Quote:
>Tony B wrote:
Quote:
>>I'm trying to understand some code on a php site I'm looking at.
>>Each page in the site has a require('filenames.php'); statement in the
>>header.
>>filenames.php has typical entries like
>> define('FILE_INDEX',DEFAULT_FOLDER .'index.php');
>>>
>>php warns that DEFAULT_FOLDER is unknown with a message like
>>Use of undefined constant DEFAULT_FOLDER - assumed 'DEFAULT_FOLDER' in
>>filenames.php on line 2
>>>
>>What is DEFAULT_FOLDER ? I searched uk.php.net and couldn't find a
>>reference to this variable ?
>Well, it is not defined, obviously. You'll need to define it the same way
>as FILE_INDEX.
>>
> Check "define" in the PHP docs and "constant". The DEFAULTS_FOLDER is a
>constant whose define is missing in your code.
>>
> Jeff
>>
I didn't write the code, but was just trying to understand it. I assumed
that default_folder must be some sort of php defined variable, which it
doesn't seem to be. I guess whoever wrote the code never used the defines
since they don't make sense.
It make sense, more or less, to me. My guess is that there is an include
somewhere that is missing that has the DEFAULT_FOLDER set.

My guess is maybe DEFAULT_FOLDER is supposed to
Quote:
be defined as the site root folder path as then FILE_INDEX would point to
the main home page ?
That would be my guess as well. Although there are times when you
don't want something to be in the web root. Hence the ability to set the
path from which all others spring forth. At least that's the way I write
my code. I keep the default settings which might change from one usage
to another in a separate file. That way if I want to use the same code
on another site, I just change one included file. Generally you really
don't want to have to go back in and change every script.

Try adding something like this:

define('DEFAULT_FOLDER',$_SERVER['DOCUMENT_ROOT'] . '/');

or use whatever path you want.

Now, I'm a php newbie myself. There's different coding styles. Some
may not mind editing the scripts themselves.

Jeff
Quote:
Tony
>
>
Closed Thread


Similar PHP bytes