[eluser]kv[/eluser]
Here is my controller code plz see the below.
file one controller:
class Contact_list extends Controller
{
function Contact_list() {
parent::Controller();
$this->load->helper('url');
$this->load->library('session');
$this->load->database();
$this->admin_url =$this->config->item('admin_url');
}
function index()
{
//load pagination class
$this->load->library('pagination');
$config['base_url'] = $this->admin_url.'/contact_list/index/';
$config['total_rows'] = $this->db->count_all('tbl_contact');
$config['per_page'] = '1';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$this->load->model('contact_model');
echo $this->uri->segment(4);
$data['results'] = $this->contact_model->get_books($config['per_page'],$this->uri->segment(4));
// load the HTML Table Class
$this->load->library('table');
$this->table->set_heading('First Name', 'Last Name', 'Email', 'Contact Date','Action');
// load the view
$this->load->view('admin/contactlist_form', $data);
}
}
///model////
class contact_model extends Model {
function __construct(){
parent::Model();
}
function get_books($num, $offset) {
$query = $this->db->get('tbl_contact', $num, $offset);
return $query;
}
}
view page:
$this->load->view($this->config->item('ADMIN_dir').'header');
$admin_url =$this->config->item('admin_url');
echo $this->table->generate($results);
echo $this->pagination->create_links();
$this->load->view($this->config->item('ADMIN_dir').'footer');