Part of the EllisLab Network
   
 
SVN change : defining EXT
Posted: 03 July 2009 08:34 AM   [ Ignore ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

The latest change is in the index.php file

define('EXT', '.php');

My first reaction was, if the constant value is a string why not move it to the constants.php file?

Profile
 
 
Posted: 03 July 2009 08:40 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2690
Joined  05-18-2008

Bacause of line 115 in index.php?
The EXT value is used for all the other includes, so without it, you can’t load codeigniter.php and therefore you can’t get the constants.php file

 Signature 

I’m building a Project Management System for my 3rd year Uni project, Sign up to the beta
Track my progress | Post of the day: UI Designs
Get full auto complete support for CodeIgniter in Eclipse

Profile
 
 
Posted: 03 July 2009 08:55 AM   [ Ignore ]   [ # 2 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

True but if you are going to set the constant with a string isn’t that a sign the constant isn’t really needed? Who is going to change the extension of all the framework files?

Profile
 
 
Posted: 03 July 2009 11:22 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  82
Joined  05-31-2009

why did the php file extention need to be defined in the first place :|

 Signature 

ThriftyPHP Web Development Framework

Profile
 
 
Posted: 03 July 2009 12:57 PM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2916
Joined  07-27-2006

why did the php file extention need to be defined in the first place :|

There are plenty of reasons. Don’t you think if someone had some sort of requirement where they wanted a different extension, they’d scream bloody murder that CI locked them in. It’s an example of constantly asking, “What happens if…” while developing, which everyone should do. “What happens if the server should only parse .phtml extensions through the PHP parser?” “What happens if users want to force CI to run as PHP 5, but not legacy code elsewhere, so they use a .php5 extension.” Etc.

True but if you are going to set the constant with a string isn’t that a sign the constant isn’t really needed?

Well, the string should never change, therefore it’s a constant. There is also the subject of “developer experience” to take into consideration. For instance, sometimes you would rather have something like

if ($_SESSION[USER_SESSION_FLAG] == USER_IS_AUTHENTICATED)

than just ‘key’ == TRUE/FALSE. It may be more verbose but it reads better and is self-documenting.

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

Profile
 
 
Posted: 03 July 2009 01:10 PM   [ Ignore ]   [ # 5 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

Sure having the EXT constant gives you a single point of entry, but the change makes it static instead of dynamic. It seems a step back.

Profile
 
 
Posted: 03 July 2009 01:44 PM   [ Ignore ]   [ # 6 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2916
Joined  07-27-2006

How is it made static? It’s still in an application-level file. And the EXT constant has been there for a long time now. Maybe all the way back to the first release. It was just moved. Much ado about nothing.

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

Profile
 
 
Posted: 03 July 2009 01:54 PM   [ Ignore ]   [ # 7 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

the line was

define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));

so with the change you have to change the extension yourself where the bootstrap file was used to extract the extension from.

Just because it is been that way for so long why did it go to a static string?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120375 Total Logged-in Users: 19
Total Topics: 126496 Total Anonymous Users: 4
Total Replies: 665217 Total Guests: 286
Total Posts: 791713    
Members ( View Memberlist )