I still have the training wheels on, trying ColdBox.
If I have a link and use this Outdoor Specialty 2013
I get where I need to – the page / view for Outdoor Specialty 2013. I noted through the handler that market_code = 114 is then in the rc. I can use that little bit of info to gather model data to give to the view.
My question is: is this the best way to send the request through the framework " <a href="…/index.cfm/markets/marketHome?market_code=114 " just like I may normally on any web page?
I like to avoid putting anything in the URL that could get tweaked …/marketHome?market_code=114… if I can help it. Is there another way?
Well… first of all… take a look at buildLink(). It will generate your hrefs for you.
Secondly, there is nothing inherently wrong with using URL variables like you have here. Since are using SES urls, so you could simply create a route in routes.cfm that permits you to pass that market_code as such:
Here is the route to make this work…
addRoute(pattern="/markets/marketHome/:market_home/", handler=“markets”, action=“marketHome”);
If you want a slightly prettier URL, you could pass the name of the market as a URL variable.
addRoute(pattern="/markets/:market_name/", handler=“markets”, action=“marketHome”);
Just be sure that route above appears above the standard Coldbox route in routes.cfm.