routing and pagination problem

#1
[eluser]LeonLanford[/eluser]
Hi, I'm new to codeigniter. I've read URI Routing manual and this thread. I have the same problem like that thread, I want to remove 'index' from the URI (http://localhost/igniter/hello/index/10) to (http://localhost/igniter/hello/10).

URI routing doesn't work for me so I use _remap function, but it made pagination doesn't works. If I press page 2, it keeps bold at page 1.

My question:
Is there something I need to do to activate the routing or fix the pagination when using _remap function?

I already tried to change
Code:
$config['uri_protocol']    = "AUTO";
QUERY_STRING and ORIG_PATH_INFO makes the page redirected to welcome page, others are just 404 not found error.

I also already change index_page to blank
Code:
$config['index_page'] = "";

htaccess code
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Here's the controller code
Code:
<?php
class Hello extends Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        //$route['hello/:any'] = "hello/index/$1";
        //$route['hello/10'] = "hello/index/10";
        //$route['(:any)/'] = "hello";
    }
    
    public function _remap($strMethod='index')
    {
        call_user_func_array(array(&$this, 'index'), array_slice($this->uri->segment_array(), 2));
    }
    
    function index()
    {
        $this->output->enable_profiler(TRUE);
        
        $page_limit = 10;
        
        $segmen = $this->uri->segment(2,0);
        
        $this->load->model('hellomodel');
        $data['query'] = $this->hellomodel->get_entry("category", $segmen, $page_limit);
        
        $this->load->library('pagination');
        //$config['base_url'] = base_url().'hello/index/';
        $config['base_url'] = base_url().'hello/';
        $config['total_rows'] = $this->db->count_all('category');
        $config['per_page'] = $page_limit;
        $this->pagination->initialize($config);
        echo $this->pagination->create_links();
        
        $this->load->view('helloview', $data);
    }
}
?>

Thanks


Messages In This Thread
routing and pagination problem - by El Forum - 09-22-2010, 11:22 AM
routing and pagination problem - by El Forum - 09-22-2010, 11:38 PM
routing and pagination problem - by El Forum - 12-03-2010, 10:00 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.