
A new feature in CakePHP 2.1 is the ability to make one view extend another view. This is a very neat feature; it’s actually quite similar to the concept of Jquery template. The concept behind it is relatively straight forward. You define one view that contains common elements that will be updated in another view. The goal is to avoid duplicating the HTML in a different view.
Category: CakePHP
-
CakePHP Extending one View from Another
-
CakePHP 2.x Login System
Well, since one of my most popular all-time blog posts is Login system with CakePHP in under 10 minutes I think it’s time that I update it to version 2.x (currently 2.2 at the time of writing). The original post was probably written for version 1.2 or 1.1 and there have been several changes made, especially with breaking changes to the AuthenicateComponent.The beautiful part is the changes are extremely limited. In fact, only the UsersController requires a few minor changes.
-
A Short Rant About Coding Conventions
Yesterday’s article actually got me a little amped up about coding conventions – Comparing a while loop against a foreach loop of an array – because I never thought I would actually have to do a comparison between a while loop and a foreach loop on an array! If we go back and revisit the post, I was reviewing a recent CakePHP commit for an optimization on the Hash class. The code in question is three separate blocks of code that leverage the array_shift function to get the next value in the array with a foreach loop instead. -
Are you having CakePHP and NGINX Rewrite Rule Issues?
In a recent blog post – It’s LEMP Not LAMP – I discussed about making the switch to using NGINX (pronounced Engine-X). I had little-to-no issues getting by basic WordPress blogs up and running. However, for some reason I couldn’t get my older CakePHP sites up and working.I was racking my brain forever, trying everything I could think of with the rewrite rules – thinking for sure this must be the root of the cause. In the end I thought it might just be an issue with the version of CakePHP I was using, as it was an older version (1.2.x). However, I just grabbed a clean copy from CakePHP’s Github of 1.2.10 and got it up and running without issues.
I’m of course even more confused at this point, so why am I writing this blog post you ask? The answer is simple, if you’re having issues with getting an old CakePHP site to work on NGINX, try upgrading your CakePHP version. (more…)
-
CakePHP Version Comparison with PHP Version Comparison
I’ve seen a few recent blog articles comparing the new version of PHP 5.4 to its predecessors and I thought I should get involved with this a bit as well.
To perform this test, I will layout the conditions I have chosen. I’m trying to keep this as simple as possible. I currently run a Dell Laptop with Windows 7 on it:
Windows NT 6.1 build 7601 (Unknown Windows version Business Edition Service Pack 1) i586
Because I often do a lot of .NET development recently I have PHP running as a CGI under IIS 7.5.
I then created a very simple .NET application that performs 100 requests of the same web page and tracks the response time. These lists of response times are sorted and the highest and lowest responses are dropped. The average is then calculated from this.