Ads Inside Post

Search in This Blog

Remove Controller and it's method form codeigniter

How to remove Controller in  codeigniter and it's method just show it's parameter in url for ex:


http://localhost:90/CodeIgniter_2.1.4_new/category/show/this-is-the-test.html
as
http://localhost:90/CodeIgniter_2.1.4_new/this-is-the-test.html

Goto routes.php under config directory:
write this listed below line
$route['(:any)'] = "category/show/$1";
==============================
====================================================
create a new file "category.php"
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Category extends CI_Controller {
    public function index() {
        $this->load->view('welcome_message');
    }
    public function show($text) {
            echo "aaaaa".$text;  
    }
}