Welcome Guest, Not a member yet? Register   Sign In
URI routing: method is also being passed as paramter
#1

[eluser]Ian Beck[/eluser]
I just need some help figuring out how to debug a problem I'm having.

I'm running Matchbox to enable modules using PHP 4. For my main site, I'm using my own custom URI layout by utilizing _remap. In the admin area, however, I'm relying on the standard CI URI mapping. I have the following route defined in the routes.php config:
Code:
$route['admin/gallery/(.*)'] = 'gallery/admin/$1';

The edit method of the gallery/admin (that is gallery module and admin controller) accepts an ID.

When I visit the URL 'site.com/admin/gallery/edit/1/' the edit method is called as I would expect, but instead of passing '1' as the ID, 'edit' is passed. Particularly bizarre is that the routing for the standard admin area works perfectly.

Any ideas what might be causing this or how I can debug it? I haven't had any luck so far.
#2

[eluser]Ian Beck[/eluser]
I'm currently using a dummy variable in all methods for this particular controller, but I would really love to hear if anyone has an idea how I can debug this problem. It potentially could make upgrading my CodeIgniter install a nightmare.

Does no one have any debugging suggestions, or is the problem not clear?
#3

[eluser]coffey[/eluser]
I also use matchbox and came across a similar problem where the url is referencing a second controller. The matchbox documentation suggests that this parameter should be automatically seen. This didn't happen with me.

modules
-admin
--controllers
---admin.php
---node.php

url = something like 'index.php/admin/node/edit/1/1/'

My solution was to add a parameter/segment 'catcher' and all works fine now.

Code:
function edit($id = 0, $type_id)
    {
        $id = $this->uri->segment(4, 0);
        $type_id = $this->uri->segment(5, 1);
        ...etc...

Hope this helps




Theme © iAndrew 2016 - Forum software by © MyBB