NYCPHP Meetup

NYPHP.org

[nycphp-talk] Setting Constants Globally?

Malcolm, Gary gmalcolm at professionalcredit.com
Fri May 9 13:20:30 EDT 2003


do you define the default include directory in your php.ini? It can have a
list of paths... 
(I put the path to PEAR, and the path to my typical includes there) AND it's
outside of my docroot

> -----Original Message-----
> From: Jim Musil [mailto:jmusil at villagevoice.com]
> Sent: Friday, 09 May, 2003 10:16 AM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Setting Constants Globally?
> 
> 
> 
> This seems to be the best solution, but the problem I have 
> with this is that
> you still have a path definition in every file. If for some 
> reason that
> location changes, you have to change it in all your scripts.
> 
> I'm sure I could search and replace the whole lot of them, but it just
> strikes me as messy.
> 
> The situation in which it arises the most is when I have a 
> shared set of
> development tools that I use on various pages across several different
> virtual hosts.
> 
> I don't want to do this:
> 
>     include("/usr/blah/blah/blah/blah/devtools.php");
> 
> I'd rather do this:
> 
>     include(DEVTOOLS);  //  DEVTOOLS is defined in one place 
> server wide
> 
> 
> Jim
> 
> 
> 
> On 5/9/03 12:40 PM, "Malcolm, Gary" 
> <gmalcolm at professionalcredit.com> wrote:
> 
> > I have a file with my system wide defines ( define( 
> "THING", defintion); )
> > as an include on another file where i put my most common 
> includes (like my
> > db classes).
> > I then will include the second file to avoid tons of 
> includes in each
> > script.
> > 
> > defines are global within individual scripts.
> > 
> > works well for me...
> > 
> > I'm curious how others handle this seemingly common issue.
> > 
> >> -----Original Message-----
> >> From: Jim Musil [mailto:jmusil at villagevoice.com]
> >> Sent: Friday, 09 May, 2003 9:34 AM
> >> To: NYPHP Talk
> >> Subject: [nycphp-talk] Setting Constants Globally?
> >> 
> >> 
> >> 
> >> Hi,
> >> 
> >> Pardon me if the answer to this question is obvious, but is
> >> there a way to
> >> define my own constants that are global for all php scripts?
> >> 
> >> I see that I could auto_prepend a file to every script, 
> but I'm more
> >> interested in being able to set my own constant.
> >> 
> >> Something like PATH_TO_DEVTOOLS ...
> >> 
> >> Maybe there is a better way to do something like this?
> >> 
> >> 
> >> 
> >> Jim
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> > 
> > 
> > 
> > 
> > 
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030509/730238ec/attachment.html>


More information about the talk mailing list