Category: CakePHP

  • Facebook, Photos, and You!

    The Facebook Application API is quite extensive and allows you to get and set many different aspects of a user’s Facebook information.

    Today, we are going to discuss using the Facebook API to create an album, if it doesn’t already exist, and add a photo to that album. (more…)

  • Caching Queries in CakePHP

    If you haven’t noticed already, at times CakePHP can be a little slow loading!  The reason for this is quite simple.  Rapid Application Development.  To allow for RAD, sometimes we must give up something, in this scenario it’s a bit of speed when loading.  Don’t worry, CakePHP offers some excellent utilities to help with this.

    The one I will focus on today is caching our CakePHP query results.  The key to this is, we are caching the results, not the queries themselves.  If you know databases well, you may be thinking, “why do I want to cache queries, doesn’t my database server do this already?”  The answer to the question is, yes it does.  However, CakePHP still needs to call the database query and parse your results.  What I’m proposing, will avoid both of those steps and allow you to just retrieve the results.

    This process not only avoids excess load on the database, it also reduces PHP’s processing time that CakePHP has to do to provide you with such useful arrays. (more…)

  • Custom pagination query in CakePHP

    My pet peeve list seems to grow on a regular basis.  One of them is poorly optimized code.  Not only is the code I’m going to discuss poorly optimized, it’s from the documentation of CakePHP!

    If you search for creating custom pagination in CakePHP, you will find quite a few results, potentially this one.  The one that I would assume the best would be the one from CakePHP itself, but it’s not and let me show you why. (more…)

  • 3 Flaws to CakePHP’s AuthComponent

    Good Friday to all.  Over the past several weeks I have been working a lot with the AuthComponent in CakePHP and have learned a couple of lessons that I wanted to share with you all.

    The title calls them “flaws”, but I suppose this isn’t completely accurate, it depends how you look at it.  To me they are flaws because I assumed the AuthComponent worked one way, only to find out different. (more…)

  • A friendly framework reminder

    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…)