id replace the url |
[eluser]cmarra[/eluser]
Hello, how can I sotituire id in a url like example.com/index.php/products/shoes/show/123 with a name of a file? for example if 123 is the id of a file, I can make the URL example.com/index.php/products/shoes/show/guide_php
[eluser]pickupman[/eluser]
Similar to how must CMS systems work. Pass the parameter to your function, lookup "slug" (filename) in database for the file / file id, and handle accordingly. You could use a regular expression to make it work for either or. Code: function shoes(){
[eluser]cmarra[/eluser]
maybe I did not understand your answer but I try to explain better: for example in this case http://www.voices.com/people/MichelleFalzon "People" is the controller and "MichelleFalzon" is the resource or other parameter that is passed to the controller which then will return the resource ... I would do the same thing .... how can I proceed side code?
[eluser]pickupman[/eluser]
Yes you would do the same as the example I provided above. You are just looking a name rather than a id for a record in the DB. You will just have to make sure that a name cannot be entered twice, otherwise the second record wouldn't be accessible.
[eluser]cmarra[/eluser]
Maybe I have to work with custom remap URL by URL routing?
[eluser]pickupman[/eluser]
My apologies, I hadn't notice that you were giving another example with a different number of segments. You would use a route like: Code: $routes['people/(:any)'] = 'people/function/$1';
|
Welcome Guest, Not a member yet? Register Sign In |