Blog

  • 5 Tips to Become a Better Web Developer

    So, you are looking to become a better web developer?  Well, the fact that you are willing to read this article is a great start!  It’s actual one of my five tips.  I’ll begin by listing, what I believe, are the most important pieces in becoming a better web developer.

    1. Test
    2. Adapt
    3. Think/Plan
    4. Trial and Error
    5. Ask for help

    (more…)

  • Login system with CakePHP in under 10 minutes

    ** If you’ve found this article through a Google search, visit my CakePHP 2.x Login System for an updated version of this article. **

    In today’s article, I am going to discuss how simple it is to setup a login system with CakePHP.  As the title says, it should be less than 10 minutes.  In theory if you copy and paste the code below, it should be fully functional in less than 5.

    Ready, set, let’s bake. (more…)

  • Optimize your CSS and JS with CakePHP in minutes

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

  • Importance of using the CakePHP Helpers

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

  • Re-map key/value array data in PHP

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