Welcome Guest, Not a member yet? Register   Sign In
Your Recommended Way Of Handling URI Segments? And Why?
#1

[eluser]mdvaldosta[/eluser]
I'm wondering what YOUR recommended way of handling uri segments, and WHY? I've always used something like:

Code:
function items($action = NULL, $id = NULL)
{
    if($action == 'add')
    {
        // Add new item
    }
    elseif ($action == 'edit' && $id != NULL)
    {
        // Edit item
    }
    // etc. etc.
}

But was considering using uri segments or _remap but didn't want to change if it was just a coding style preference. Just wondering what others are using and why they were doing it that way. Code examples are a plus.
#2

[eluser]n0xie[/eluser]
This is my way...
Code:
function add()
function edit($id)
#3

[eluser]Federico BaƱa[/eluser]
I use $this->uri->segments(), it makes the code easier to read...

Code:
function edit()
{
    $par1 = $this->uri->segment(3);
    ...
}




Theme © iAndrew 2016 - Forum software by © MyBB