User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 363,798 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,633 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 175 | Replies: 3 | Solved
Reply
Join Date: Feb 2008
Location: Ottawa, Ontario
Posts: 15
Reputation: mom_of_3 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
mom_of_3's Avatar
mom_of_3 mom_of_3 is offline Offline
Newbie Poster

To define() or not to define() that is the question..

  #1  
May 8th, 2008
I have a question about using define(). I am using this function for other constants across my script ,but am looking at developing a set of language files. For example I was thinking of having one eng_defined.php and one fr_defined.php each containing the same named constants but the output would be in different languages. When the user selects to view the site in their language of choice it would display the value of the constant in that language, but then I wondered if an issue would turn up if I used define() this way?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2008
Location: UK
Posts: 51
Reputation: xan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
xan's Avatar
xan xan is offline Offline
Junior Poster in Training

Re: To define() or not to define() that is the question..

  #2  
May 8th, 2008
If you make a single page (for example index.php) and include the language file depending on which language is wanted, this is a perfectly acceptable use of the define() function. as it will standardize the scripts.
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,869
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 109
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is online now Online
The Queen of DaniWeb

Re: To define() or not to define() that is the question..

  #3  
May 8th, 2008
I don't see a problem with this because either eng_defined.php OR fr_defined.php would be called, so it would behave just as if all of the constants were defined once. From then on, you can use define to see if the constant exists.
Reply With Quote  
Join Date: Feb 2008
Location: Ottawa, Ontario
Posts: 15
Reputation: mom_of_3 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
mom_of_3's Avatar
mom_of_3 mom_of_3 is offline Offline
Newbie Poster

Re: To define() or not to define() that is the question..

  #4  
May 8th, 2008
Thank you both for response, it is very helpful.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC