Category: Development

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

  • The flaws of using isset()

    I am starting to really dislike the PHP function isset().  Today, I was working on a registration system in CakePHP and my password validation was not working.  If I left the password field blank and clicked submit, it would come back with other errors, but then the password would come back populated with a long string – a hashed version of an empty string!

    After some investigation, I discovered that the AuthComponent in CakePHP was doing an isset() check on the username and password fields.  If isset() returned true for both, it would hash the password. (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…)

  • Unbind Model Validation in CakePHP

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

  • Jquery vs Prototype/Scriptaculous

    About two years ago I started learning AJAX and drag and drop.  The first project I applied it to was an existing project that was using Prototype and Scriptaculous.  So, I didn’t really have a choice as to what library I was going to use.

    Two years later, I do not know Jquery all that well, but I am absolutely falling in love with.  Doing things with Jquery seem to be 10 times easier to me.

    I always struggled with the each() function that I seemed to be constantly using with Prototype.  Jquery seems to understand this and simplify things for us.

    In this article, I’m going to describe my top reasons why I am becoming a Jquery lover over Prototype. (more…)