20 Jan 2010 @ 4:37 PM 

CakePHP offers a lot of functionality to us as developers. The ability to develop websites rapidly provides a trade-off in how quickly the website will load. As we expand our skills, we will learn the techniques that will slow down/speed up performance.

Objectives

  • Apply techniques to speed up CakePHP’s load time
  • Optimize our queries
  • Cache query results

More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 04 Feb 2010 @ 05:10 PM

EmailPermalinkComments (1)
Tags
 15 Nov 2009 @ 5:24 PM 

Two of the biggest things that will improve your search engine rankings are keyword rich website titles and keyword rich links to your content. Today’s lessons will cover both of these topics.

Objectives

  • Improve our search engine rankings
  • Set a title tag
  • Map a specific URL to a custom controller and action
  • Avoid using ids or numbers in our URL

Before I start, I would like to make it clear that this article is and does not intend to be a be-all-to-end-all of the SEO necessities for your website. It is meant to describe some excellent techniques to quickly and easily improve upon CakePHP to make it more SEO friendly. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 15 Nov 2009 @ 05:25 PM

EmailPermalinkComments (2)
Tags
 20 Aug 2009 @ 5:06 PM 

Ugggh what a disaster today was!  On a client’s site, we have an older version of CakePHP, pre containable functionality.  Because of this, we have to use unbindModel and bindModel to accomplish the same functionality.

Over the past while, it has not been such a big deal.  However, for some other unknown reason, a search feature wasn’t returning back the appropriate associative data.  This had been working for quite some time, then suddenly stopped.  As I mentioned, I’m not exactly sure when and why it stopped working, but it did. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 20 Aug 2009 @ 05:06 PM

EmailPermalinkComments (0)
Tags
Tags:
Categories: CakePHP
 01 Apr 2009 @ 4:30 PM 

Quite often at work, I find myself reminding my team members to be sure to ALWAYS utilize the framework to it’s fullest.  Just because you are unsure how to do something or have never done it before in the framework, does NOT mean that it cannot be done!

I use to have this thinking as well.  I would curse and curse, I’ve done this a 100 times, why is it so difficult to do with this framework!

Once I calmed down, I would Google it or look around the documentation and pretty quickly discover how to accomplish it using the framework.  9 times out of 10, I found that it was actually extremely easy to implement.  Not only that, 7 or 8 times out of 10, it would actually save me time!  If it didn’t the first time, it certainly always saved me a lot more the next time. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 01 Apr 2009 @ 04:31 PM

EmailPermalinkComments (0)
Tags
Tags: ,
Categories: Theory
 28 Mar 2009 @ 4:30 AM 

Have you found yourself wanting to remove validation on a specific field in a specific form?  Yes?  Excellent, you found the right place.

If you haven’t had the need for this, a great example of where you would want to accomplish this would be in a users edit form.  Normally in CakePHP we would encrypt the password, especially if you are using the AuthComponent, so we wouldn’t want the password prefilled on our form.  Instead, we’ll make it blank and place a note underneath that says “Only enter a password if you wish to change it”.

The above shouldn’t be difficult, however, when you go to use the form, you will get some unexpected results.  I keep getting a message saying that I must enter a password, because I had setup validation on that field for the registration process.  Below is a simple solution to this problem. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 28 Mar 2009 @ 04:30 AM

EmailPermalinkComments (3)
Tags
Tags: ,
Categories: CakePHP
 21 Mar 2009 @ 11:28 AM 

One of my first articles discussed YSlow.  An excellent Mozilla add-on to help you understand why your web page may be loading slowly.

In that article, I describe the importance of gzip, minify, and grouping your Javascript and CSS code into one file each.

Just recently I was surfing CakePHP’s bakery and found a nice add-on to simplify the process and make it super easy. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 21 Mar 2009 @ 05:40 AM

EmailPermalinkComments (0)
Tags
 20 Mar 2009 @ 11:41 AM 

Uggghh, I hate to even be writing about this!  I have been spending the past two days cleaning up a project that has been running for over one year.  It was our first ever CakePHP project at our company and we were too lazy to be consistent about using $html->link() when creating our links.

Just recently the client has requested a change for their Facebook application.  We simply need to add a “requirelogin” HTML attribute to every link. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 19 Mar 2009 @ 04:50 PM

EmailPermalinkComments (0)
Tags
Tags: ,
Categories: CakePHP, Theory
 19 Mar 2009 @ 12:17 PM 

I was recently tasked with a situation where I needed to populate about 10 different “Settings” for every user in the current database.

This example is specifically for CakePHP, however, it could easily be used elsewhere.  My goal was the following, I had an array that was key value paired as follows:

array(
 [0] => array(
  ’User’ => array(
   ’id’ => 1)
  ),
 [1] => array(
  ’User’ => array(
   ’id’ => 2)
  ),
 [2] => array(
  ’User’ => array(
   ’id’ => 3)
  ),
 [3] => array(
  ’User’ => array(
   ’id’ => 4)
  ),
)

The result I needed was as follows:

array(
 [0] => array(
  ’UserSetting’ => array(
   ’user_id’ => 1)
  ),
 [1] => array(
  ’UserSetting’ => array(
   ’user_id’ => 2)
  ),
 [2] => array(
  ’UserSetting’ => array(
   ’user_id’ => 3)
  ),
 [3] => array(
  ’UserSetting’ => array(
   ’user_id’ => 4)
  ),
)

With a few simple lines of code, I was able to quickly and easily achieve this, let me show you how. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 18 Mar 2009 @ 06:22 PM

EmailPermalinkComments (2)
Tags
Tags: , ,
Categories: CakePHP, php
 15 Mar 2009 @ 2:26 PM 

On some of our more recent projects, we have been using the Containable behavior that CakePHP provides.  It works quite nicely, a lot easier than the previous format of having to bind and unbind models on the fly.

The pitfalls began to appear when some of our clients were reporting that some pages are extremely slow.  After a bit of research, it was quite apparent that the root of the cause was attributed to us using the containable feature. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 15 Mar 2009 @ 02:26 PM

EmailPermalinkComments (13)
Tags
 14 Mar 2009 @ 3:03 PM 

As my office gains more and more experience with CakePHP, we are beginning to learn to build more organized web sites.  Looking back at our first few projects, I’m astonished to see how messy our controllers are!

I know the controllers are the “brain” of MVC because it pieces our data to our views, but that doesn’t mean everything should go in there.  Our original controllers would contain all of our logic, all of our data manipulation, all of our custom queries, and some additional data validation.

We are now working very hard to keep our controllers as clean and simple as possible.  My goal is to make every function in our controllers under 20 lines of code.  It might sound ambitious, but I think it is completely feasable. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 14 Mar 2009 @ 03:03 PM

EmailPermalinkComments (10)
Tags
Tags: ,
Categories: CakePHP

 Last 50 Posts
 Back
Change Theme...
  • Users » 8
  • Posts/Pages » 72
  • Comments » 198
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight