Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
markoshust's picture
Asked by on Wed 15th Jul 2009
How can I pass in more detailed URL parameters to a custom module?

Hi all, I am new to Drupal and am developing a more advanced search function. I need to create URLs in the format of domain.com/customsearchmodule/country/USA/state/OH/city/Cleveland, and then reference the different variables via the given parameter name in the module (for example, I need to access the value of ‘country’, the value of ‘state’, etc.). I need this to work in a similar way to domain.com/customsearchmodule?country=USA&state=OH&city=Cleveland via $_GET params, but I need to do it without the querystring for SEO purposes. I would use arg(0), arg(1), etc., but I am going to have at least 10 parameters, and they will not always be in the same position (for example, if someone passes in /country/USA/city/Cleveland, I would want it to show all of the cities named Cleveland in USA, not just the ones in Ohio — if I would use arg(1), it would not know whether this is a state or a city). Can anyone help me out on how to accomplish this? I need these params to be able to be called from both a regular node and block. Thanks -Mark

Commenting on this Drupal Question is closed.