Watch Your Paths

Wow, after spending four hours on a trivial issue, I finally figured out the problem. It was the most bizarre thing. I'd added some logging to see why a session variable was changing from one page to the next only to discover that my action was being executed numerous times per page request (and each subsequent page request changing a time-sensitive session variable).

Digging my way through the Cake code didn't seem to reveal anything that would cause this. Then I uncovered the truth: some relative image paths were calling my actions.

I had built my HTML templates outside of Cake and have been copying and pasting them in as I build out my application. Nothing extraordinary by any means. Some of the image paths weren't going to be updated until I got that particular functionality tied in. It's clear now that my image paths should always be updated to the proper folder before moving on.

On a side note, I helped troubleshoot a similar issue with someone who was having CSS rendering issues in Internet Explorer 6 and Expression Engine (made by the same guys who built Code Igniter, which has many similarities to CakePHP).

Published July 27, 2006 · Updated July 27, 2006
Categorized as CakePHP
Short URL: