Welcome Guest, Not a member yet? Register   Sign In
SEF URLs and database
#1

[eluser]Unknown[/eluser]
I have a database with many products.
Using routing I was able to get SEF URLs like 'http://site.com/view/saw'.

My problem is that product names are not unique ... so I must specify the id in the URL.

What is the best way to do it:

1. something like 'http://site.com/view/saw-1234' and then parse the id from the name?
2. put id in it's own segment 'http://site.com/view/1234/saw' and then check id and name?
#2

[eluser]qwertyqwerty[/eluser]
Personally, I'd get rid of the product name and just use the ID as the url is still SEF in terms of no query string stuff.

Otherwise I'd go with solution 1, but in your db lookup code, use regex to strip out the alphabetical characters so you're left with the id.




Theme © iAndrew 2016 - Forum software by © MyBB