yeah sure :) but please explaing when you want to change to url; do you want the url /blog/topic/test to be equivalent to /blog/topic/6/test (which sounds a bit odd to me because you can probably not identify the right topic anymore, unless test is a unique name), or do you want to just filter out the number after someone already reached the controller by requesting the first version of your url? In that case, depending on the strictness of the syntax of your url, an explode() or a call to a regex function would do
well the problem here is that you need the id somehow to designate the right post. So this can only be done if either the string test is a unique identifier, so you could do something like SELECT * FROM your_table WHERE topic_slug='test' or if you have saved the id already in a session. Because php can do alot, but not magically read the user's mind to fetch the desired topic :)
well then, if 'test' is the topic title you have a chance, but then you have to make the title unique, which is most of the times not desirable. Otherwise, to make it look a bit sweeter you can turn them around (title and id).
well wordpress creates unique slugs; when you have title like This is my blogpost, it converts it to this-is-my-blogpost, saves it in a unique mysql cell and looks it up when needed. When you have two of the same titles, you could convert the slug, as it's called, to this-is-my-blogpost-2 or something like that. Think of your own logic for handling that type of situations. But it can be done if you add a new column in your database!
/blog/topic/testto be equivalent to/blog/topic/6/test(which sounds a bit odd to me because you can probably not identify the right topic anymore, unlesstestis a unique name), or do you want to just filter out the number after someone already reached the controller by requesting the first version of your url? In that case, depending on the strictness of the syntax of your url, an explode() or a call to a regex function would dotestis a unique identifier, so you could do something likeSELECT * FROM your_table WHERE topic_slug='test'or if you have saved the id already in a session. Because php can do alot, but not magically read the user's mind to fetch the desired topic :)This is my blogpost, it converts it tothis-is-my-blogpost, saves it in a unique mysql cell and looks it up when needed. When you have two of the same titles, you could convert the slug, as it's called, tothis-is-my-blogpost-2or something like that. Think of your own logic for handling that type of situations. But it can be done if you add a new column in your database!