Category: PHP

Posted on: January 25, 2012 Posted by: John Huh Comments: 3

PDF for Codeigniter

There is no default PDF library for Codeigniter. Pick and choose what’s the best. Anyone have a favorite? fPDF mPDF mPDF with Codeigniter PDF generation using dompdf fpdf CIed

Posted on: August 9, 2011 Posted by: John Huh Comments: 0

New framework for PHP?

I’ve been watching FuelPHP framework for sometime and they finally released v1.0. If you are used to Codeigniter, you may not be all enthusiastic about how FuelPHP does things. It’s different and I’m willing to dig in deeper. It would be nice to see a chart of comparisons.

Posted on: May 20, 2011 Posted by: John Huh Comments: 5

Best CodeIgniter Editors

10 million years old question… What is your PHP IDE editor? This question should be more specific to CodeIgniter. So, what is your best CodeIgniter editor? For multi-platform? I’ve come up with below. Suggestions welcomed. Multi-platform o Aptana o Dreamweaver o Eclipse o Komodo Edit o Netbeans o PHPStorm o …

Posted on: February 15, 2011 Posted by: John Huh Comments: 0

Processing large XML

What is the optimized method of parsing a large XML file? Using XMLReader (http://php.net/manual/en/book.xmlreader.php) is the best method AFAIK. Because XMLReader is stream-based pull parser, the memory usage should be much less than loading the XML file. I’ve tested on a large xml report generation and worked very well. Additional …

Posted on: February 7, 2011 Posted by: John Huh Comments: 0

Codeigniter 2.0 Command Line Interface

Command Line Interface for Codeigniter is now built-in! Woohoo~~~ So now you can add your cronjob as: [sourcecode] php /YOURFULLAPPLICATIONDIRECTORY/index.php /CONTROLLER/METHOD [/sourcecode] This is all you need!!!

Posted on: January 20, 2011 Posted by: John Huh Comments: 0

Google Analytics API for Codeigniter

So… I’ve been trying get Google Analytics traffic data. Quick and dirty way was to alter the gapi.class.php provided by Google (http://code.google.com/p/gapi-google-analytics-php-interface/). Here’s the alteration (starting at around Line 44): [php] /** * Constructor function for all new gapi instances * * Set up authenticate with Google and get auth_token …

Posted on: January 20, 2011 Posted by: John Huh Comments: 0

When? Last week? Last year?

There are times I always write something quick to find out when was the last week’s Sunday or get starting and ending dates of last month. Every time I’d try to remember how I did it before and spend minutes, since I wouldn’t use it so often. I guess that’s …

Posted on: January 5, 2011 Posted by: John Huh Comments: 0

What’s wrong with microtime?

Calling PHP function microtime() returns two sets of numbers. Below code was puzzling me for a while but came down to one parameter which needs to be included in the microtime() function call. TRUE!!!! microtime(TRUE) is required to return the time as a float value. [php] if ($debug === TRUE) …

Posted on: December 14, 2010 Posted by: John Huh Comments: 0

Trim a sentence with length, find last word and add ellipse

[php] $len = 40; $str = ‘Returns the numeric position of the first occurrence of needle in the haystack string. Unlike the strrpos() before PHP 5, this function can take a full string as the needle parameter and the entire string will be used.’; echo trunc_description($str, $len, TRUE); /** * …

Posted on: December 10, 2010 Posted by: John Huh Comments: 0

Static what?

Lorna Jane explains about Static Method in PHP… http://www.lornajane.net/posts/2010/Declaring-Static-Methods-in-PHP Looks like above link isn’t up anymore or having issues. Additional links: http://www.brainbell.com/tutorials/php/Static_Methods.html http://phpduck.com/php-static-methods-and-properties/