cgi.path_info
variable.cgi.path_info
, but Wheels insists on creating the URLs with
the query string format), you can override it by setting URLRewriting
in
config/settings.cfm
to either On, Partial
, or Off
. The line of code should
look something like this:/index.cfm/
format.shop
is the name of the controller to call,
and products
is the name of the action to call on that controller.index.cfm
part of the URL so that
http://localhost/index.cfm/shop/products
becomes
http://localhost/shop/products
. You can read more about this in the
URL Rewriting chapter.shop
controller
(controllers/Shop.cfc
) and call the function inside it named products
.products
function could look to make it more
clear what goes on:shop
controller extends the main Wheels Controller
component. Don't forget to include that extends
attribute in your cfcomponent
call as you build your controllers!controller
and action
(among others, such as route
), and, based on these, it will try to include a view file. In our case, the view file is stored at views/shop/products.cfm
.products
function with no code whatsoever. What do
you think will happen if you just remove that entire function, leaving you with
this code?products
action and just want the view rendered directly, then you are correct.about.cfm
in the views/home
folder and access it at
http://localhost/home/about
without having to create a specific controller
and/or action for it, assuming you're still using wildcard routing.params
Structurl
and form
scopes into one. This is something that most CFML frameworks do as well. In
Wheels, it is done in the params
struct.params
struct is available to you in the controller and view files but
not in the model files. (It's considered a best practice to not mix your request
handling with your business logic.) Besides the form
and url
scope
variables, the params
struct also contains the current controller and action
name for easy reference.url
and form
scopes, the value in
the form scope will take precedence.http://localhost/account/login?sendTo=dashboard
with the variables
username
and password
present in the form. Your params
struct would look
like this:url.sendTo
, form.username
, etc.,
you can just use the params
struct for all of them instead.application/json
as it's mime type.url
and form
scopes are merged, so a valid json
body would be. The exception to the rule is when a javascript array is the root element, where it's then added to params._json
to follow Rails conventions. (For obvious reasons, we can't merge an array into a struct!)