Changing URL information without changing the code |
[eluser]Rubiz'[/eluser]
Hello everyone I wanna know if there is some way to replace de ID, in URL, for the slug of the news, without changing the original code. Today I have this: www.website.com/index.php/news/1234 << this is de ID. I have, without changing CI code, this: www.website.com/index.php/news/title-of-the-new It is possible?
[eluser]Phil Sturgeon[/eluser]
Well you cant change what the code does without changing the actual code, its impossible. You can probably keep your controllers/views the same and just change the field within the model. Code: $this->db->where('id', $id); becomes Code: $this->db->where('slug', $id); Tada.
[eluser]Rubiz'[/eluser]
I have asked here cause I have a friend with the same problem, and he could do this, the difference is that he was working with C#/.NET
[eluser]Gordaen[/eluser]
You can update your code to easily accept an id or a slug (or either), but if it's set up to accept an id only, you'll have to change it to accept a slug. |
Welcome Guest, Not a member yet? Register Sign In |