Error Validation Class for CodeIgniter Reactor 2.0

Posted by Danny Herran on May 3, 2011 in Backend | 3 comments

CodeIgniter Error Validation Class CodeIgniter lacks of an error handling class for custom errors. The Form Validation class is very nice for forms, the logs are pretty useful as well, but what happens when we need to handle our own errors?. Currently there is no official solution for this so I decided to take the matter in my own hands.

I present you the Error Validation Class.

Alternate row colors with pure CSS3

Posted by Danny Herran on Apr 29, 2011 in Frontend | 6 comments

Pure CCS3 Alternate Row Colors CSS3 is here. All the modern browsers support it, even the infamous Internet Explorer in its 9th version. In this small article we will learn how to alternate row colors in a table, or any other HTML element with pure CSS3. The best part is that you will be able to do it in just 2 lines. No more PHP hacks or JavaScript chunky chunks.

Exporting your MySQL table data with PHPExcel + CodeIgniter

Posted by Danny Herran on Mar 8, 2011 in Backend | 27 comments

PHPExcel + CodeIgniter Most of the time my clients need to download data from their database tables. Exporting to CSV is a pain in the rear for users and it leads to confusion (you know the colon and semicolon stuff). Today, I decided to make a very small controller that is portable and efficient for exporting full MySQL tables to Excel 2003 using PHPExcel and CodeIgniter.

63% of web video is HTML5 friendly

Posted by Danny Herran on Mar 2, 2011 in Frontend | No comments

63% of web video is HTML5 friendly According to MeFeedia, from all the web videos around the net, 63% of them are HTML5 friendly. For those on iPad or iPhones, it believe this is a very good thing. Flash is a thing of the past for watching videos on your smartphone or personal computer, considering a year ago the percentage of HTML5 compatible videos was just about 10%.

Facebook PHP SDK and CodeIgniter for basic user authentication

Posted by Danny Herran on Feb 24, 2011 in Backend | 209 comments


With CodeIgniter 2, plugins are no longer an option. Usually you would just add the Facebook PHP SDK as a plugin and you were good to go, but now, you need to make a little modification to the SDK in order to use Facebook Connect on your CodeIgniter application. Lets start by explaining what is, how to get started and how to authenticate an user using the Facebook API.

CodeIgniter 2.0 is out with cool features!

Posted by Danny Herran on Feb 13, 2011 in Backend | 4 comments

I know its a bit late, CI 2.0 has been out since January 28th, 2011, but lets talk about it anyway and recapitulate some of the new features of this framework. The new stuff is great, and this time I believe it deserves a second look if you are not much into CI.

Let me thank in advance the guys of the CI team for their great work.

Read Word documents with PHP (up to Word 2003)

Posted by Danny Herran on Feb 10, 2011 in Backend | 8 comments

Reading Word documents with PHP on a Linux box can be a real pain. It requires DOM which is only available on the Windows platform. However, Unkwntech from Stack Overflow made quite a nice function to read Word documents and extract its information. It will only parse text content, but it is enough for most of the tasks we will be doing anyway.

$_GET parameters on CodeIgniter

Posted by Danny Herran on Dec 13, 2010 in Backend | 1 comment

Yeah, it is a much discussed topic in every CI forum. I needed to set up a payment gateway and it was mandatory to receive the gateway response via $_GET, so I decided to do an investigation on the matter and this is what I came up with.

CodeIgniter 2.0 new FTP class “download” method

Posted by Danny Herran on Nov 25, 2010 in Backend | 3 comments

I needed to download some files from a remote FTP server and the store them in my website. The usual way would be to download all the files to my computer and then upload them to my website. In CodeIgniter 1.7.2 you would have to do this, however, the new CodeIgniter 2.0 has a new ‘download’ method that will make it real easy to transfer files between FTP servers.

Get YouTube video thumbnails (the easy way)

Posted by Danny Herran on Oct 20, 2010 in Other Stuff | 1 comment

YouTube has an API to do this, however, there is an easier way to pull the thumbnails of a specific video if you know its ID. You can use this trick in any of your applications and it is not language specific.

A little dot that made me pull my hair off

Posted by Danny Herran on Oct 15, 2010 in Frontend, Other Stuff | No comments

I was coding a long signup form, a very nice one, with the jQuery Validation Plugin, but it wasn’t working. I started to strip the code, piece by piece so I can identify what was causing the plugin to ignore the form and I came up with the most stupid error you will ever seen in your life (at least I think so).

Yes, a little dot that I don’t even know how to write with my keyboard. I even tried to replicate it and I couldn’t. 2 hours of coding wasted on this little bastard. Can you believe that?…

Trim long texts by words in PHP

Posted by Danny Herran on Oct 14, 2010 in Backend | No comments


We don’t like reading chopped sentences like “Star Wars Old Republic is be….”. It looks fugly. Usually, when trimming text you will go with substr(), but there is a much better way to do it, and believe me, you trimmed text will look so much better than before.

HTML Table Class on CodeIgniter 2.0

Posted by Danny Herran on Aug 31, 2010 in Backend | 3 comments

CodeIgniter 2.0 is coming out soon, so lets start studying the changes done to the HTML Table Class in the dev-release.

One of the most requested features was the ability to set tag attributes to individual cells. On CI 2.0 this is completely possible, however, since the documentation is not fully updated yet, I decided to make this short post to explain how it works.