Blogs of M. Mizanur Rahman

Month: November 2007

I faced a serious problem during deploying one of my CodeIgniter application to a windows server running on IIS. After installing CodeIgniter the index.php page was not visible at all. I tried many ways to configure it but it does not show anything. A problem with SEF (search engine friendly) URL CodeIgniter follows. I searched the internet but couldn’t find a suitable solution or answer to the problem. After two day I found a very good and step by step solution for this problem. You can have a look at it in the following URL.

Today i wrote a simple code to convert a number to Bangladeshi currency (taka) format. the php format_number puts a comma (“,”) after every 3 digits which is not same for Bangladeshi currency. here is the simple function to do the job for yo. it can handle integer and decimal numbers.

just downloaded the php 6.0 files from php.net cvs . i am really curious to see what’s going on with the new development. It is expected that the unicode support will be improved a lot in this version of php. Going to build it and have a look with the new version.

Many of us feels that a report without a graph is totally incomplete. I also agree with it completely. We need to represent the data in reports to be meaningful and also representable. A table with rows of data does not give the reader a clear idea about what is actually happening. So it is better to show a chart or a graph to the user before showing the long tables of data.

In PHP, one of the most popular graph tool is php/swf charts from maani.us. This tool provides some cool looking graphs with easy to integrate with your application. The integration becomes much easier if you are using Oode Igniter. In this article I am going to describe you, how to integrate maani.us php/swf charts with your Code Igniter application.

Detail Steps to Install the application:

1. download php/swf charts from http://www.maani.us

2. Create a directory named charts or any appropriate name in your root folder (not inside the Code Igniter system folder). it is better if you keep the CI system folder and charts folder on same level.

3. put the unzipped content (except the charts.php) file of the downloaded file in this folder.

Writing Code Igniter code:

You can integrate the maani.us code by either creating a library in Code Igniter or by simply creating a helper. I am going to show you the process by creating a helper file. In order to create a helper file in Code Igniter, you can either create a helper file in systemhelpers or systemapplicationhelpers file. In the later case you have to create the directory as Code Igniter does not create it by default. It is always better to keep the core files and folders of Code Igniter to be intact. Code Igniter gives you the flexibility to extend any of its helpers, libraries, plugins etc to be extended from the application folder.

here are the detail steps for creating and showing graph in a view:

1. first create a helper named graph_helper.php and copy paste the content of charts.php in this file. save the file.

2. now load the helper file from your controller where you want to show the graph. there are two parts in the helper file. One for inserting the chart and in order to show a chart, we need to define the data and chart properties. the SendChartData function defines the properties of the chart and InsertChart shows the Data. in InsertChart function we have to define few things

location of the flash file (.swf) , in our case in the charts folder in base directory.

location of the charts library, in our case in the charts folder in base directory.

PHP source location for ChartData or SendChartData function, in our case a controller.

You can copy paste this part from maani.us graph examples according to your graph choice. Just copy the first line

$this->load->helper(“graph”);

when you run the changes, you will see that the graphs are generated and it is shown in the view as expected. I have shown how to put a chart in a variable and pass it to view. It is a good way to show more than one graph if required.

I hope that shows how easily you can add a cool featured graph tool in your Code Igniter application. Let me know any comments, questions regarding Code Igniter and PHP.

Recently GMAIL released its new version and using for few days i found it really annoying as the system is very slow compared to the previous version. So, I have shift back to the old version. Few of the problems of the new GMAIL:

1. very slow in loading in both IE and Firefox.

2. worst with firebug enabled in firefox (GMAIL’s known issue)

3. Anchors in Email page does not work. It opens in a new page and huh!! the content is not loaded. I found it completely irritating. I have to scroll my mails to read that particular section.

4. Another annoying fact is if you are using older version and login next time, you are logged into the new version. Kind of enforcement!!!!

Usually people goes for performance improvement everyday. Seems that Google taking a step backward. Hope they will solve the issues asap.

I forgot to mention, GMAIL is still in Beta 😉

About Me

I am Mizanur Rahman from Bangladesh. I am a Software Engineer by profession. I love to work on open source projects and specially web based systems. I am a moderator of the PHPExperts, the largest PHP Users group in Bangladesh.

I have my own startups Informatix Technologies and TechMasters. I am an Agile enthusiast and Scrum practitioner.