function test(event,rc,prc){
writedump(var=rc, abort=true);
}
It seems like with route /test/ passing that additional variable matching stuff would stop. I see the error message is coming from ses.cfc function “findConventionNameValuePairs”. I suppose if doesn’t log it anywhere and pollute logs is ok but wondering if is proper. If I change something-something to underscore everything is fine so it’s looking at that string even though reporting “blah” as bad value.
You’re not matching your “/test/” route since that isn’t what the URL has in it. You’re hitting the second default route and the breakdown is like this:
handler: test action: something-something extra!!: blah
I assume you want to add a question mark to the end of your test route so it will match additional name/value pairs.
It’s definitely hitting the test route. Main.test is what’s running. Again, I’m testing with /test/something-something/blah or more completely maybe xyz.com/test/something-something/blah
routes.cfm has
addRoute(pattern="/job/", handler=“vacancy”, action=“showposition” );
addRoute(pattern=":handler/:action?");
In vacancy.showposition() I can easily get the job # (21345) with listlast(url,"/") but that little error msg var in rc is annoying. Not sure if should be there or not.
The issue appears to be with a hyphen in the url part. You’d have to trace through the SES interceptor to figure why it’s happening. Maybe put in a bug as well.
Found it. Route in routes.cfm should have been addRoute(pattern="/test/", handler=“main”, action=“test”, valuePairTranslation=“false”); . Just need to add valuePairTranslation=“false” to tell ses.cfc not to look for name/value pairs.
But I thought you wanted the key/value translation? Don’t you want to access rc[ ‘forklift-operator-harrisburg-pa’ ] and get a value of 21345? If not, what’s the purpose of them in the route since you’re not matching them with route placeholders and they’re not part o the actual route?
Using a job posting site as an example today we have
/job/21345
the routes.cfm entry addRoute(pattern="/job/:jobordernumber-numeric", handler=“vacancy”, action=“showposition” ); captures 21345 as rc.jobOrderNumber for handler vacancy.showposition()
Now I’ve spoken to an SEO guy and read a little online and we might be interested in the (perhaps marginal) SEO boost we would get with
/job/forklift-operator-harrisburg-pa/21345
In this example the job ID is still 21345 and the descriptive stuff is just that - descriptive text for url. So now my routes.cfm entry is
addRoute(pattern="/job/", handler=“vacancy”, action=“showposition”, valuePairTranslation=“false” ); and in handler vacancy.showposition() I’m using var jobOrderNumber = VAL( trim( listlast( prc.currentRoutedURL, ‘/’ ) ) );
It seems to work and I’m not seeing any downfalls to it. If there’s a better way I’m all for it. Just wanted to explain why the extraneous text is in the URL.
Forgot to mention that might be easier and cleaner as /job/21345/forklift… but I was taking my clue from another non-job site (grubhub) that does pretty much exact thing I’m looking at. As sort of confirmation how theirs works if you take the url below and butcher any of the text in the “descriptive” section between “restaurant/” and “/264637” you’ll still wind up in the same place. I suppose it’s done this way for the whole “relevancy vs. how many subfolders down” sort of thing…maybe.
Yeah, that doesn’t really make any sense since the SES interceptor is there to parse the path info for you, but you’re basically trying to do it all manually yourself. If you know each route will have some useless text bits and then a job number, then build those into the actual route so Coldbox can capture them for you!
Doesn’t really matter the order it comes in. For what it’s worth, I’ve heard that Google doesn’t really pay much attention to your URLs, at least not any longer. It’s really the content of your site that matters. That said, ColdBox can be configured to match whatever you need.