codeigniter - pagination links will not work -
codeigniter - pagination links will not work -
on users index page trying set ci pagination. when click on 2nd link load error page "unable load page"; have spent day on , will not load on same page. utilize hmvc not sure if effects it?
how can create load on same page. tutorials have watched show. tuts plus tutorial.
$config['base_url'] = 'http://localhost/codeigniter-project/';
url http://localhost/codeigniter-project/admin/users/
route $route['admin/users'] = "admin/user/users/index";
controller
<?php if ( ! defined('basepath')) exit('no direct script access allowed'); class users extends mx_controller { public function __construct() { parent::__construct(); $this->lang->load('admin/user/users', 'english'); $this->load->model('admin/user/users_model'); if (!$this->user->logged()) { redirect('admin'); } } public function index() { $this->document->settitle($this->lang->line('heading_title')); $data['heading_title'] = $this->lang->line('heading_title'); $this->load->library('setting'); $this->load->library('pagination'); $config = array(); $config["base_url"] = base_url('admin/users'); $config['total_rows'] = $this->db->get('user')->num_rows(); $config["per_page"] = $this->setting->get('config_limit_admin'); $config["uri_segment"] = 3; $this->pagination->initialize($config); $data['user'] = $this->db->get('user', $config["per_page"], $this->uri->segment(3)); homecoming $this->load->view('user/users_list', $data); } }
view
<?php echo modules::run('admin/common/header/index');?><?php echo modules::run('admin/common/column_left/index');?> <div id="content"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <?php if ($this->session->flashdata('error')) { ?> <div class="alert alert-danger"><i class="fa fa-times-circle"></i> <?php echo $this->session->flashdata('error');?></div> <?php } ?> <?php if ($this->session->flashdata('success')) { ?> <div class="alert alert-success"><i class="fa fa-check-circle"></i> <?php echo $this->session->flashdata('success');?></div> <?php } ?> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"><?php echo $heading_title; ?></h3></div> <div class="panel-body"> <?php echo '<div class="table-responsive">'; echo '<table class="table table-striped table-bordered table-hover">'; echo '<thead>'; echo '<tr>'; echo '<td class="text-center">' . "user id" . '</td>'; echo '<td class="text-center">' . "username" . '</td>'; echo '<td class="text-center">' . "status" . '</td>'; echo '<td class="text-center">' . "date added" . '</td>'; echo '<td class="text-center">' . "action" . '</td>'; echo '</tr>'; echo '</thead>'; foreach ($user->result() $row) { echo '<tbody>'; echo '<tr>'; echo '<td class="text-center">' . $row->user_id .'</td>'; echo '<td class="text-center">' . $row->username .'</td>'; echo '<td class="text-center">' . $row->status .'</td>'; echo '<td class="text-center">' . $row->date_added .'</td>'; echo '<td class="text-center">' . anchor("admin/users/edit/" . $row->user_id, '<div class="btn btn-primary text-right" role="button"><i class="fa fa-pencil"></i> edit</div>') .'</td>'; echo '</tr>'; echo '</tbody>'; } echo '</table>'; echo '</div>'; echo '<div class="row">'; echo '<div class="col-sm-6 text-left">'; echo $this->pagination->create_links(); echo '</div>'; echo '</div>'; ?> </div><!-- . panel panel-body --> </div><!-- . panel panel-default --> </div><!-- . columns --> </div><!-- . row --> </div><!-- . container-fluid--> </div><!-- #content --> <?php echo modules::run('admin/common/footer/index');?>
i had brain storm , added $route['admin/users/(:num)'] = "admin/user/users/index/$1";
, links work.
codeigniter
Comments
Post a Comment