Welcome Guest, Not a member yet? Register   Sign In
Arguments to controler function
#1

[eluser]yannyannyann[/eluser]
Hi,

For the moment i have this URI

Code:
mysite.com/collection/detail/4
=> (controler/function/id)


But I would like to have :

Code:
mysite.com/collection/detail/this-is-the-title-corresponding-to-the-id
=> (controler/function/nice-url)


So when I click on a link I'd like to send this information :
Code:
?id=4&nice;-url=this-is-the-title


Is it possible to send 2 or more variables to my controler function ?

How could I achieve this nice-url structure ?

Is there another way ?
#2

[eluser]GSV Sleeper Service[/eluser]
there's a couple of ways.
Code:
function detail($id, $nice_url)
{
    ...
}
or using the URI class
Code:
function detail()
{
    $id = $this->uri->segment(2);//cant remember if uri segs are zero indexed, these numbers may be out by one
    $nice_url = $this->uri->segment(3);
}
both can be accessed using domain.com/detail/4/nice-url-example
#3

[eluser]yannyannyann[/eluser]
Ok thanks,

I was wondering how to do the url like in the FaceBook photo albums:

AJAX + change URL

I have already implemented a jQuery ajax.
How could I say "put the title of my image in the url as well" and without refreshing please ?




Theme © iAndrew 2016 - Forum software by © MyBB