Category Archives: CakePHP

Officially published my CakePHP Book

Finally!  It has been a long time in the making, but my book is finally finished and published!  About two years ago, I began the undertaking of writing a book.  At the time it was merely a hobby while I was working on my blog.  Seeing if I could turn the success of my blog articles into a book.

As you may recall a few months ago, I released an e-book.  This e-book was basically my original works written for CakePHP 1.2.  I saw some success with the e-book, so that made me believe that I should seek publishing on my book.  Unfortunately, there isn’t much hope for mainstream success with a big publisher like O’Reilly because CakePHP is too small of a niche for them to focus on.

During this time, I focused on upgrading the book to be relevant to CakePHP 1.3.  I even added a special bonus chapter about upgrading from CakePHP 1.2 to 1.3, which I must say was extremely painless; especially if you stick with the standards.

Anyways, I hope you take the opportunity to view my CakePHP book.

Enjoy!

Share

CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

When I first started using CakePHP a few years ago, we had a lot of complaints about speed.  If you do some Google searches comparing CakePHP to other frameworks, it seems to be near the bottom of the pack.  I previously wrote a few articles on optimizing CakePHP here:

Implementing the following tips certainly helped; however, if there are issues with the core framework response time, no amount of optimization will truley help.  So after reading up on CakePHP 2.0 and it’s recent speed improvements, I wanted to do some straight CakePHP comparisons.  Below are 10 load times for CakePHP 1.2, 1.3, and the new 2.0.  These load times are of a brand new install simply loading the default home view, no database connection or any model loading. Read more »

Share

AJAX Star Rating Plugin For CakePHP

First off, I didn’t write this plugin, I was browsing CakePHP’s plugin bakery and it came from there:
http://bakery.cakephp.org/articles/schneimi/2010/08/19/ajax-star-rating-plugin-1

This is an excellent plugin and very easy-to-use.  The above article is extremely detailed and provides excellent step-by-step instructions to set it up and get it running.

In reviewing the comments, like any self-made plugins there were a few issues encountered and ironed out along the way, so if you run into any issues be sure to search the comments.
Enjoy this excellent Star Rating Plugin for your next or current CakePHP site!

Share

CakePHP 2-0 Ajax Pagination WITHOUT The Pages

As I promised in this article, I have created a full CakePHP example of performing AJAX pagination without the pages.  The goal of this article is to display news articles to a user.  As the user scrolls down, we will dynamically load in additional content so they can continue to scroll and read.

One of our challenges is to not load too much or too little content.  For more details on this, please review the theory article.  Let’s begin. Read more »

Share

CakePHP CSS Enhancements From 1.2 To 1.3

This article does seem a bit late since CakePHP 2.0 is on it’s way.  However, I felt it prudent to point out a few things that I’m really happy to see in the new default CSS provided by CakePHP.

On CakePHP’s website, you will find an excellent migration guide from 1.2 to 1.3 here:
http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3

It describes in great detail the various changes throughout the entire application and there are a lot of them.  But I think it left out some of the most important stuff, the default CSS provided for people who use the bakery to create their websites!

One of the things that irked me in 1.2 was I had to manually update the paginator helper to display what field is currently being sorted on.  Many times I had to ensure my peers were also doing the same thing and a lot of time was wasted checking this and ensuring it was done correctly. Read more »

Share

Publishing an e-book on Smashwords

I feel a little bit behind in the times on this one, but I’ll work to catch up quickly.  Over the past year or so I’ve been compiling samples and I put together a book for developing CakePHP websites.  I saught publishing on the book, but unfortunately all of the big name publishers felt that CakePHP is too small of a market.

After being rejected, I wasn’t too sure what to do with the book.  So, I left it for a while.  Then, earlier this week through some Google searching I stumbled upon the idea of an e-book.  Previously I’ve associated e-books with “Get rich quick schemes” as you see a lot of websites selling e-books along those lines.

I started investigating this option a bit more and I found some videos about creating e-books with Adobe Indesign and formatting them for the various readers.  This quickly started sounding like a lot of work!  Instead I searched for other solutions.  That’s when I found it: Smashwords.  This is an incredible service.  You upload your Word Document and they automatically convert it for the over 10 e-book options out there!  Not only that, they will sell it and promote it on your behalf. Read more »

Share

Interesting CakePHP Bakery Components

I enjoy researching what other people are doing in the CakePHP world and I came across several interesting components at CakePHP’s bakery website:

Wizard Component

http://bakery.cakephp.org/articles/jaredhoyt/2010/09/10/wizard-component-1-2-1

This component looks pretty neat and easy-to-use.  You import the component and set a list of steps that the wizard will traverse through.  You then create views for those steps with forms that submit to themselves.  The wizard will then process the form and proceed to the next step for you persisting the data along the way.

Breadcrumbs Component

http://bakery.cakephp.org/articles/rees/2010/08/14/breadcrumbs

This is a component and helper all-in-one.  Inside your controllers, you define the breadcrumbs in each function and you alter your app controller to automatically render the breadcrumbs on each page for you making it a pain-less process to add breadcrumbs to your site!

SMS Text Message Component

http://bakery.cakephp.org/articles/donald_jackson/2010/08/14/component-to-send-sms-text-messages

This is a component that is written specifically for Panaceamoblie that is a helpful service to allow your website to send SMS services.  It works very similar to the EmailComponent.

Share

CakePHP 2.0 Rant Retraction

In yesterday’s article, it appears I may have misunderstood something regarding lazy loading.  I incorrectly read it as “loading the data” on-demand oppose to loading the object on-demand.  This actually looks like a great feature, especially after reading this: http://bakery.cakephp.org/articles/Frank/2010/08/10/optimizing-model-loading-with-lazymodel

It appears associated models would automatically be loaded simply because they are related to the model you are querying, even if you are not retrieving data from it.

Thanks for the clarification on lazy loading Jose and I’m actually quite excited to see this change after further research into the situation.  Check out these benchmarks from the above mentioned article:

Before lazy loading

Total Requests made: 100
Total Time elapsed: 6.8480186462402 (seconds)
Requests/Second: 14.603 req/sec
Average request time: 0.068 seconds
Standard deviation of average request time: 0.002
Longest/shortest request: 0.078 sec/0.066 sec
Memory usage: 9.75MB

Post lazy loading

Total Requests made: 100
Total Time elapsed: 4.8957378864288 (seconds)
Requests/Second: 20.426 req/sec
Average request time: 0.049 seconds
Standard deviation of average request time: 0.001
Longest/shortest request: 0.056 sec/0.048 sec
Memory usage: 7.25MB

Almost 6 full requests more per second!  Just in the 100 requests made there is over 2 seconds being gained!  Excellent work community!

Share

CakePHP 2.0 Rant

I was recently visiting the CakePHP bakery and decided to read a little bit about CakePHP 2.0-dev.  I’ve rather enjoyed CakePHP as a framework since version 1.1 all the way through to version 1.3.  However, after reading some of the “features” for version 2, I have to say, I’m a little disappointed about their focus. Read more »

Share

Using the TextHelper with CakePHP

Really, the TextHelper?  Yes, this is probably one of the most overlooked helpers in CakePHP.  Sure we all know about the HTML Helper, Form Helper, JS Helper, etc… but how many of us use the Text Helper?  I’ve seen so many custom functions for truncating text and adding an ellipsis (…) to the end of it.  How about replacing email addresses with links?  Etc…  No more I say!  Let’s begin explorining the Text Helper now. Read more »

Share

Buy one of my books