Technology Cares

Not Just another weblog

Archive for July, 2009

Pagination in CodeIgniter

Posted by Manish on July 27, 2009

Pagination in codeIgniter is a pretty easy task. Often times we, as a developer come across the problem which requires us to show a list of data in the webpage from some source, for example database. In such situation, we would like to split the whole result into multiple pages and provide the users with page navigation option. For this kind of situation, codeIgniter provides us with a Pagination class that is pretty easy to use and implement.
Steps to follow:
First we open our config.php file (which can be found in /system/application/config/). Here we will enter our Base Site URL.
$config['base_url'] = "http://localhost/unemed/";

Suppose we have our database setup and created our model to communicate with our database. So the next step would be to add few lines of codes in our controller
$this->load->model('agreements');
$this->load->library('pagination');
$config['base_url'] = base_url().'index.php/agreement/getMTA/';
$config['total_rows'] = $this->agreements->MTATotal();
$config['per_page'] = '8';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
$data['MTADetail'] = $this->agreements->MTADetail($config['per_page'],$this->uri->segment(3));
// load the HTML Table Class
$this->load->library('table');
$this->table->set_heading('MTA ID', 'Material', 'Organization', 'Status', 'Next Update');
$this->template->load('publicUser/templatePage', 'publicUser/agreement', $data);

Finally we would want to add following lines to our view to show the the result with the pagination
echo $this->table->generate($MTADetail);
echo $this->pagination->create_links();

*The code here is extracted from the UNeMed project that I have been working on.

Posted in Uncategorized | Tagged: , | Leave a Comment »

IBM Page Detailer

Posted by Manish on July 22, 2009

As I was working on Performance issues of the website and finding out the bottlenecks that prevent the website from being loaded fastly from client’s perspective, I came around with this graphical tool which is very nice and easy to use and gives us the information on how our page contents are being downloaded and executed. This tool is IBM Page Detailer.

*Here’s a little note if anybody wants to use the tool in Vista.
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=13857549
You need to edit the wd_WS2s.ini file and edit the DO NOT MONITOR topic to enable
Executable=(SVCHOST.EXE)

Posted in Uncategorized | Tagged: | 1 Comment »

14 Rules for Faster-Loading Web Sites

Posted by Manish on July 22, 2009

This is a very interesting book about increasing the performance of website in the client side. It talks about 14 rules to follow in order to speed up the processing in the client side. The author claims that they have been able to reduced the response times of the pages by 25-50% by following the rules. At this time the book seems to be misplaced from our office, we are still searching for it.
However, I found that there is also the website of the book http://stevesouders.com/hpws/rules.php which has all the rules demonstrated with examples.

Posted in Uncategorized | Tagged: , | Leave a Comment »

Google Ajax Search API

Posted by Manish on July 15, 2009

The Google AJAX Search API lets you put Google Search in your web pages with JavaScript. You can embed a simple, dynamic search box and display search results in your own web pages.

Simply sign up for an API key at http://code.google.com/apis/ajaxsearch/signup.html and you can add a Google AJAX Search module to your site.

Going through the few examples at http://code.google.com/apis/ajaxsearch/documentation/ would be sufficient for the headstart.

Posted in Uncategorized | Tagged: , | Leave a Comment »

Securing Email Addresses

Posted by Manish on July 6, 2009

Its been long time I did blogging; summer class and internship took a lot out of me. Finally summer class is over and I’m back for blogging.
This one is about securing email addresses from any spammers out there in the web. A lot of websites provide email addresses of the people in the web in order to expand their network. We see a lot of those in pages like ‘contact us’ in any website. However providing email addresses in the web is prone to getting a lot of spams or even flooded with the junk mails from everywhere. And it is always advisable to secure the email addresses from getting into the hands of spammers.
In the recent work I did for the website(sbric), I used two techniques to protect email addresses.

1. I used image instead of text to show the email address. In coldfusion, there is a CFML tag called ‘cfimage’ which can convert the text into image by providing certain parameters.

2. I used the concept of email riddler(http://www.dynamicdrive.com/emailriddler/) to create a function in coldfusion to encrypt and transform the email address into a series of numbers such that nobody could find the actual email address even if they wish to view the source code of the page.

*Check out the page at (http://137.48.124.35/contact/contact.cfm)
*This link might not work later as we are still in development phase right now

Posted in Uncategorized | Tagged: , | Leave a Comment »