First, add a new route to config/routes.cfm that catches your products
like this:
<cfset addRoute(name="product", pattern="[title]",
controller="product", action="index")>
Now when you type in "http://localhost/keyboard" this route will be
triggered and the Index action will be called on the Product
controller with params.title set to "keyboard".
The problem with that is that this will break any of your normal
controllers though so you'll have to add them specifically before this
route.
You'll end up with a config/routes.cfm file looking something like this:
<cfset addRoute(name="main", pattern="main/[action]",
controller="main", action="index")>
<cfset addRoute(name="cart", pattern="cart/[action]",
controller="cart", action="index")>
<cfset addRoute(name="product", pattern="[title]",
controller="product", action="index")>
<cfset addRoute(name="home", pattern="", controller="main", action="index")>
"main" and "cart" are your normal controllers and by adding them to
the top of the routes file Wheels looks for them first.
As for rendering a different view depending on the product the user
wants to see I suggest calling renderPage in the Index action of the
Product controller like this:
<cfset renderPage(action=params.title)>
Good luck :)
/ Per
--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels.
For more options, visit https://groups.google.com/d/optout.