Fixing PATH_INFO on bluehost and other shared hosts

The first time I setup an Expression Engine site on bluehost, and removed the index.php file via the .htaccess file, I ran into a problem where every template was redirecting back to the main index template. At the time, I traced this down to fact that the “segments” were not getting populated properly.
A brief search led to the EE wiki, which advocated swapping out PATH_INFO for ORIG_PATH_INFO. Although not being a fan of hacking core stuff, I was kind of cornered into this, so I went for it. This has been my running solution for the past two years.
Recently, I ran into an issue where the $_SERVER['PHP_SELF'] was not returning anything after the file name. In other words, for http://mysite/foo.php/bar, PHP_SELF should be equal to foo.php/bar.
I spoke with my host about it (a similar host to bluehost), and they said to put the following in the php.ini file: cgi.fix_pathinfo=Off
After, I did this, PHP_SELF worked fine. Unfortunately, I ran into a similar situation like I described at the outset. Then it hit me…I changed ORIG_PATH_INFO back to PATH_INFO and…it worked!
So now I listed this as another potential solution in the EE wiki.

, , , ,

4 Comments

The joys of the command line

I’ve always loved the unix command line and its power. I recently found the website http://www.commandlinefu.com which people can submit their own command line goodies. This really shows off the power of the command line!

,

No Comments

Templatizer

I released an extension the other day for EE. You can find it here.

The basic idea is that creating templates in Expression Engine, especially if you don’t plan to edit them from the CP, can sometimes be a little repetitive and annoying.
Normally with EE, the templates are stored in the database, and you have the option of also storing them on the filesystem. But in order for them to be recognized by EE, they must reside in the database at least.

Using this extension, you can start your template off as a physical file, and the first time you view it in the browser, it will automatically be recognized by EE and inserted into the database!

, , ,

No Comments

Flash Messenger for Expression Engine

A common idiom in web development is that a form is submitted via POST, and then a redirect is done to a success page. The reason for this is that if we left the result of the submission to return HTML to the browser, we would run into the infamous and confusing message “To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.” (At least the way firefox tells you). This has become none as the POST/REDIRECT/GET pattern.

The problem becomes that, because of the stateless nature of HTTP, this second request has absolutely no connection to the previous request. If we just wanted to display a thank you page, or a success page, this would not be much of a problem. But what if we wanted to display the same form again, and display a success message on top when its submitted?

One way of doing this, which is the way Expression Engine does it, is to pass in a parameter in the query string, like ?success=1. The problem with this is that now if somebody refreshes the page, they’ll see the same message. Not the biggest deal in the world, but can we do better?
Read the rest of this entry »

, , , , , , ,

3 Comments

Antipodes

When I was growing up, we would often speak about digging a hole in our backyards and winding up in China. As I got older, I always wondered if this was, in fact, true. It turns out that you have to be somewhere in Argentina to pull this off.

No Comments

ACL in Zend Framework

When I first started using the Zend Framework, one of the most confusing things was the ACL component. Even after I succesfully implemented an ACL solution in my app, something seemed wrong with it.

I would like to argue that the proper use for the Zend ACL is actually impossible, since there is a reported bug in the code which, to my knowledge, has not been fixed.

The use case I will discuss is where you want to only authors to edit articles and only to articles authored by themselves. I think this is a fairly common case.
Read the rest of this entry »

, , ,

18 Comments

Presenting a list of Timezones to the user

 

I first got into timezones when I working on an calendar app which displayed various times of day which are pertinent to Jewish daily life. The app would display calculated times which of course would differ based on the timezone of the given location. As I investigated into timezones, I found them to be fairly complicated. Not all timezones are even on the hour…some are at 30 minute offsets, some at 45 minutes, and historically there have been even stranger offsets than that.

To make matters worse, there’s the whole issue of Daylight Saving Time. Apparently some places have it some don’t. Some countries have a set date for DST, some pick a new one each year depending on circumstances. And of course, DST does not mean only adding one hour. 
Read the rest of this entry »

, , ,

19 Comments