Welcome Guest, Not a member yet? Register   Sign In
How do I insert a dash in my URL?
#1

[eluser]Unknown[/eluser]
How do I get a URL to display a dash?


Code:
example.com/section/newitem/1

to appear like this

Code:
example.com/section/new-item/1

I assumed I had to use the url_title() function with the URL helper,
but I don't know how and where to insert it in my newitem function
Code:
function newitem($id = '')
{
    if (!$id) {
    $this->load->view('item_view');
    } else {
    $this->load->view('item_' . $id);
    }
}
#2

[eluser]Colin Williams[/eluser]
You would need to use a route because function names can't have dashes.
#3

[eluser]uptime[/eluser]
Having matching urls <> functions (using an underscore instead of a dash between words) would make more sense to me.




Theme © iAndrew 2016 - Forum software by © MyBB