Document templates with odtPHP and CodeIgniter 1.7.2

If you want to generate documents from your data (database, xml or any other source), I’ve found that odtPHP does a very good job. So here is a simple tutorial on how to use this library. 1. Download odtPHP from http://www.odtphp.com/index.php?i=download 2. Extract the zip file somewhere where you like, you will see there will … Continue Reading

CodeIgniter 1.7.x and Timezone

Just yesterday I saw a post on the Codeigniter forum, it was a question about setting the timezone every time a query is run. I had a similar problem before so this is the solution I used class Master_model extends Model{ public function __construct(){ parent::__construct();   $this->set_timezone(); }   public function set_timezone(){ $this->db->query("SET time_zone=’+0:00′"); } … Continue Reading

PHP 4&5 constructor

When developing different kind of applications, there will come a time when you’ll be deploying your application in different versions of php (4.x or 5.x). Several times I had to go through the php classes and modify the php contructor from /** * PHP 4 Compatible Constructor */ function myClass() { //some code here } … Continue Reading

PHP count() function

Today while working I needed to count an array, I knew the function count(), everything was working, until the array was empty, in which case count() function was returning 1. It was wrong, in which case, a solution to all this misunderstanding was this simple code snippet if(is_array($list_of_something)) { $count = count($list_of_something); //some other code … Continue Reading

CodeIgniter 1.7.2 Blog – Part 1.1 – Database

As every application there is a starting point, some prefer drawing, some designing etc., as the first step of application development. I prefer separating the modules, and based on the module to build the database. I will be using MySQL v5.1. UTF-8 will be the encoding for multilanguage support, and InnoDB  storage engine (since it … Continue Reading

Introduction to CodeIgniter 1.7.x

Almost everyone programming in PHP after a time has used a framework, either for fast(sometimes +dirty) development or just for fun. CI is right for you if  (extracted from http://codeigniter.com/user_guide/) You want a framework with a small footprint. You need exceptional performance. You need broad compatibility with standard hosting accounts that run a variety of … Continue Reading

PHP – Sending emails with SMTP

Time after time you will come to a time when you’ll need to send emails, but the classic PHP function “mail()” won’t work, this is where SMTP comes into play. Using PEAR mail package you can send SMTP email, here is an example: 1 2 3 4 5 6 7 8 9 10 11 12 … Continue Reading