mercredi 29 juin 2016

dynamic url parameters when first ones are null

I have a page with 5 filters on it, I use GET method so I receive url like candidates/filter?gender=M&country=USA&language=english. My boss wants me to do url like candidates/male/USA/english, ok, I know how to do it, but when only language is set I receive url like candidates/any/any/english. my boss wants me to remove 'any' from url and gives me as a example this filter. As you can see when you select only Subject the url became search/subject, when you select Term and Subject it became search/term/subject, when you select all three filter url contains all three search/country/term/subject. How do they do that?

The only one I can guess for now: they takes first parameter for query string, ex 'business', and search it in countries list, if found then first parameter is country, not found -> search business in terms list, found then first parameter is term, not found -> search in Subjects, found -> first parameter is Subject. not found -> then no results. But what if we have two equal list in filters, ex for passport country and residence?

so, the questions is:
1. maybe I missed something and now there is a way to make dynamic url like search/english and we know that english is language, not gender and residence?
2. how mentioned above site do that?




Aucun commentaire:

Enregistrer un commentaire