Welcome Guest, Not a member yet? Register   Sign In
routes.php doesn't seem to do anything
#1

[eluser]Unknown[/eluser]
I am running codeigniter 2.0 locally using MAMP.

I have a controller as follows:
Code:
<?php
Class Choose extends CI_Controller
{
    public function index()
    {
        $this->load->view('college_home',);
    }
    
    public function view($cat,$subcat,$idnum)
    {
        $data['cat'] = $cat;
        $data['subcat'] = $subcat;
        $data['idnum'] = $idnum;
        $this->load->view('college_view', $data);
    }
}
?>

so as long as my URL contains all the necessary arguments ($cat, $subcat, $idnum) then the URL works without errors.
<br>
This is good except that sometimes i'd like to leave the arguments $subcat and $idnum blank in the URL (i'd like them to each = 0 when not needed)
<br>
To do this I figured I could, for example, re-route the URL as follows:
Code:
$route['view/category'] = "view/category/0/0"

but it does nothing.. I've tried all the uri_protocols in config.php... I've tried with and without .htaccess... I've tried routing even one class to another(just for testing), and the routes don't ever do anything for me!
<br>
I feel like there must be some configuration I'm missing.. I hope I've given enough information to get some help. it seems like a basic idea but perhaps there is a better way to achieve what I'm trying to..

any help is much appreciated! thanks!




Theme © iAndrew 2016 - Forum software by © MyBB