Welcome Guest, Not a member yet? Register   Sign In
controller/index/arg ==> controller/arg?
#4

[eluser]Pascal Kriete[/eluser]
Code:
$segments = $this->uri->segment_array();

$args = array();

// Only do this if we have more than a controller
if (count($segments) > 1)
{
    // Not index - must be an argument
    if ($segments[1] != 'index')
    {
        // Drop controller from array
        $args = array_slice($segments, 1);
    }
    // Index was given for whatever reason
    else
    {
        // Drop controller and index
        $args = array_slice($segments, 2);
    }
}

Change it accordingly if you use folders.

edit-add: it would probably be easiest to extend the url helper with a function that does this instead of doing it every time.


Messages In This Thread
controller/index/arg ==> controller/arg? - by El Forum - 05-16-2008, 03:01 AM
controller/index/arg ==> controller/arg? - by El Forum - 05-16-2008, 03:07 AM
controller/index/arg ==> controller/arg? - by El Forum - 05-16-2008, 03:46 AM
controller/index/arg ==> controller/arg? - by El Forum - 05-16-2008, 04:26 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-08-2008, 04:07 PM
controller/index/arg ==> controller/arg? - by El Forum - 10-08-2008, 04:21 PM
controller/index/arg ==> controller/arg? - by El Forum - 10-08-2008, 06:10 PM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 12:50 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 01:16 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 01:21 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 01:22 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 01:30 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 02:25 AM
controller/index/arg ==> controller/arg? - by El Forum - 10-09-2008, 07:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB