Archive

Posts Tagged ‘Codeigniter’

Gedit Modifications for PHP

May 17th, 2009 3 comments

Since i am coding with codeigniter framework on gedit, i was looking for snippets for codeigniter on gedit

download gedit snippet for codeigniter

By the way if you want to make your gedit more useful for programming surely you may add some third party plugins as many as you want or simply just active default plugins. Idea is that firstly download a plugin then extract its content to ‘~/.gnome2/gedit/plugins/’ directory. Once you have installed the plugin you want, you need to enable it via Edit>Preferences and then the Plugins Tab. Such as;

- Snippets
- Class Browser
- Bracket Completation
- Character Map
- Embedded Terminal
etc..

You can basicly find out third-party plugins by clicking on this link

VN:F [1.9.22_1171]
Rating: 6.0/10 (8 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: General, Linux, PHP, Programming Tags: , ,

CodeIgniter How to Pagination

November 12th, 2008 3 comments

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks.

CodeIgniter’s Pagination class is very easy to use, and it is 100% customizable, either dynamically or via stored preferences.

If you are not familiar with the term “pagination”, it refers to links that allows you to navigate from page to page, like this:

« First < 1 2 3 4 5 > Last »

function shownews()
{
if($this->userlib->logged_in()) 
//checking for security purposes
{
$this->load->library('pagination');
$per_page = 10; 
// How many pages you want to show in each page
$total = $this->db->get('posts', $per_page, $this->uri->segment(3)); 

//Here is the most important part actually. 
Basically $total variable determined which 
rows you are going to show in the page

$config['base_url'] = base_url().'/index.php/admin/shownews';
$config['total_rows'] = $this->db->count_all('posts'); // Count total rows in the query
$config['per_page'] = $per_page;
$config['num_links'] = 6;
$this->pagination->initialize($config);
$data['posts'] = $total;
$this->load->view('admin_shownews', $data);
} else {
$this->load->view('admin_logineed');
}
}

After getting done with this configuration part of pagination class all you have to do is just initialize it like you are doing it in most of programming languages.

Read more…

VN:F [1.9.22_1171]
Rating: 7.1/10 (41 votes cast)
VN:F [1.9.22_1171]
Rating: -1 (from 5 votes)