Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.

Posts Tagged ‘frameworks’

Working Around CodeIgniters Default Session Library

Posted by chris on November 12th, 2011 Comments (4)

Recently I was attempting to test a web application using BrowserCam. BrowserCam has a bank of virtual machines on different versions of many platforms including Apple OSX, Linux Fedora, and Windows. While attempting to regression test in older versions of IE I noticed I absolutely could not log in to my application. This only occured on BrowserCam. After testing other CI based sites over BrowserCam I eventually narrowed it down to CodeIgniters session library. The session library that ships with CI does not use the native PHP session based files. It instead stores everything in an encrypted cookie. I think this is bad for two reasons: One, it goes against a PHP developers conventional wisdom of how sessions are handled and two, cookies have a storage limitation.

After poking around for some solutions I determined everything out there would cause me to have to change a lot of code. I needed a drop in replacement that would cause me minimal changes. I wrote the following library called Trusession. You simply drop it into your application/libraries folder and do some simple find and replaces. Trusession has most of the same method names, parameters, and return values as CodeIgniters native session library so your application should start working again out of the box except it will now be using PHPs file based sessions. There are a few of the public methods that I did not implement, calling these will result in an exception telling you that it has not been implemented and will give you a stack trace. These can easily be implemented by reverse engineering the CI Session library.
Read the rest of this entry »

In Programming (, , , , , , )

Inheritance in CodeIgniter: Adding More Functionality To Your Models

Posted by chris on October 28th, 2011 Comments(0)

I recently blogged on Reducing Code using CodeIgniters Active Record Class. In this blog I focus on easily collecting data from your object members using get_object_vars(). After using this for a while I found that unsetting certain members prior to an insert/update became rather annoying. I’ve been knee deep in Code Igniter for the past 6 months (and CakePHP at my new job) so I decided to take what I’ve learned and create me own parent model class.

Code Igniter allows you to create your own parent Controllers and Models. This is a great way of extending core functionality into child models via inheritance. The CodeIgniter documentation covers this in Creating Core System Classes so I won’t go into that process too much. Instead I’ll focus on what I’ve done and how it speeds up programming by:

  • Reducing boiler plate CRUD code.
  • Handling basic data validation.
  • Leveraging InnoDB to automatically join tables. (I’m saving this one for another blog)
Read the rest of this entry »
In Programming (, , , , )

My First Code Igniter Project (Part 2)

Posted by chris on March 16th, 2011 Comment(1)

This is a continuation of blog on My First Code Igniter Project.  In my first post on Code Igniter I learned how to: remove the ugly URLs, include CSS, JavaScript, and header/footer files, make and use helpers, and also use Active Record.  Since my last post I’ve been mostly spending time on non Code Igniter centric pieces of my project such as the database schema and the user interface.  I had originally decided NOT to use Ajax in this application, but after looking over the interface I decided it was needed to provide a rich user experience.  So lets cover Ajax.
Read the rest of this entry »

In Programming (, , , , , , )

My First Code Igniter Project

Posted by chris on March 9th, 2011 Comments (2)

Two things got me interested in using a PHP framework recently. One was this article by Matthew Inman covering how he built a complete site in 66 hours using CakePHP.  The other was stepping head first into a new company with a less than friendly code base with no standards.  If those two things can’t get you interested in a development framework (be it custom or community driven) then you can’t be saved.  Having previously tried CakePHP I was not interested in adhering to its strict set of standards.  After reviewing Code Igniter I was pleased that it didn’t have a strict rule set to follow beyond its implementation of MVC. Here is a review of my first project.

Read the rest of this entry »

In Programming (, , )