I’ve a database with cities. And every city belongs to a municipality and a municipality belongs to a province. To create nice SEO friendly URLs I’ve saved a slug into my database. For example: noord-holland-wijdemeren-s-graveland. Where province is noord-holland, municipality wijdemeren and city s-graveland.
So far so good! But how i can create the url in my website using CHtml:link that goes to the URL just mentioned. Because the slug in the database is saved as ‘noord-holland-wijdemeren-s-graveland’ and not ‘noord-holland/wijdemeren/s-graveland’.
So my city record looks like this in the table:
id_city country_id province municipality city sluge
1 1 Noord-Holland Wijdemeren 's-Graveland noord-holland-wijdemeren-s-graveland
You are saying that you do not save province, municipality and city and at the same time your table contains province, municipality and city so finally do you save them separately in your table or not? If you do it is easy just pass them as parameters to chtml::link if you don’t you would have to do some more manipulation on the slug before you can render the link as you want it
thats not what i said. the problem is that i can’t build my url according to the information stored in the database. i stored the province name, municipality name and city name. those three together i used to build my sluge (SEO friendly name), also save in the database