Five days of Code Igniting

Filed under: Development — Micheal on February 29th, 2008

CodeIgniter is Hot!

For the longest time I have searched for a suitable framework for rapid development that could scale easily. About 1.5 years ago I sat down and wrote my own. My goal was for it to have a small foot print, use MVC architecture, be module, allow for easy template management and also for easy routing while using mod_rewrite. In the end I achieved all these things except the MVC was more like VC and realistically most of the time more V.

About 4 months after I finished a modest sized (~7,000 lines) program sitting on top of my framework, I discovered CodeIgniter. I nearly cried, actually I think I did. I could have written the same problem in half the time. I felt like I had reinvented the wheel. I wrote my own libraries, routing, helpers, etc and CI has everything, including an awesome MVC architecture that is actually MVC!

I have been looking forward to the opportunity of using CI for a large sized project. After several months of planning with a client, I broke ground recently on a good sized project that will probably last several months. I am amazed at how much I achieved in 5 days. What I enjoy most about CI is how limited its functionality is; there is no template system (there is a template parser) and no user management system (there is a session library).

My focus this week was laying the foundation. This is a large program that will be used by many requiring varying levels of access and must also be HIPAA compliant. I wrote the following:

Template System

  • Manages assets (CSS, JS, images, etc) based on the application. CI allows for multiple applications utilizing the same core, I wanted to have the ability to use multiple templates under one app.
  • Dynamically creates navigation based on the URI, will create unlimited levels, can activate a particular item if found in the URI ~~ Plenty of recursion here
  • Just one call for the view
    • $this->template->view(’view_name’, $data, false, ‘optional template name’);

User Management

  • Security is number one priority here through a combination of hooks, DB session library, and encryption library. Did I mention I love CI hooks!
  • Access control, oh golly gosh. This is really the reason I spent so much time writing the template and navigation libraries. Based on the users group or permission id found in the DB session, not only will it restrict access but will automatically render the navigation elements based on the users permission. A hook will check the users id against the requested controller and redirect if necessary.

It’s funny, during this week I was able to get very deep into CI very quickly. I wrote some awesome libraries and even found some bugs in the core that was easily fixed because CI’s community had already discovered them. Needless to say I am very pleased with CI and look forward to further development.

If you PHP and have even a slight handle using OOP, check out CodeIgniter!


Falling in Love with Drupal

Filed under: Development — Micheal on October 24th, 2007

Drupal

About three weeks ago I started work on a “pro bono” project for my Alma Mater. Once I produced the mockup I decided this would be a good opportunity to integrate with a different framework. To save time, money and provide a quality product I was on the hunt for the right framework. I wanted a framework that would provide flexibility so someone else could take over in the future and also provide scalability so if the project grows beyond our current vision the framework would handle it. After rummaging through several frameworks, I came across Drupal.

I found many reports stating there is a learning curve with Drupal, even for the seasoned PHP developer, and they weren’t kidding! However, once I dived in and figured out the template system it was pretty smooth sailing from there on. The content management portion of Drupal is awesome. I find that the learning curve is in discovering that referencing Drupal’s API is a must for overrides. Just to get the menu system to work the way I designed it, I had to create two overrides for the main and sub navigation. Since there is a definite limit on time with this particular project I absolutely love Drupal’s modules. The modules are simple and give just enough features to do the job. With all the power of Drupal, I found it strange that the output was built into the modules instead of using a MVC architecture. In order to change the layout of a particular module view, one must create an override in the template.php to then tell Drupal to pass the data to a template file. All and all Drupal is great if someone is looking for a feature rich CMS/framework that is scalable. It is important to determine if Drupal is right for the project. I would not choose Drupal if I were going to be doing a lot of heavy development, I would choose ExpressionEngine because it is based on the awesome framework CodeIgniter.

Once I rap this project up I will post some details and a link. We’ll see how excited I am at that time!