Skip to content
llamapope edited this page Sep 14, 2010 · 4 revisions

Currently, BigRig uses the route name to identify which application folder to load, so the role of route names are a bit different than Wheels routes. Think of the primary purpose for routes under BigRig as a way to identify which specific application folder to use rather than distinct names for patterns. In the future, you should expect to be able to use routes as you do in traditional Wheels applications when using BigRig, but we’re not there yet.

Here is an example of a general route that will work for any folders with wheels apps in them in the myrigs/ folder. (Note that the addRig() function will set the 3 default routes up for your application folder for you)

<cfset addRoute(name="myrigs", pattern="myrigs/[myrig]/[controller]/[action]/[key]") />

A specific application could have its routes defined like this:

<cfset addRoute(name="myrigs", pattern="blog/[controller]/[action]/[key]", myrig="blog") />

The main limitation being you have to be extra careful of how you organize your routes, as the first match wheels finds will be used, and you have to have keywords to differentiate patterns, as the name always has to be the name of your BigRig folder(the one that holds all the extra wheels apps).

I’m looking at better ways to do this, but like the simplicity of just using the route name to identify where the request should go.

One way to get around this, if you need more complex pattern based routes, you can always call a specific controller by using the following pattern when specifying a controller:

#bigRigFolderName#.#rigFolderName#.#controllerName#

So following the examples above, you could do something like this from any controller in any application running under BigRig to get a link to your blog’s rss feed(assuming that is what the blog’s feeds controller rss action produced):

#linkTo(controller="myrigs.blog.feeds", action="rss", key="xml", text="Blog", class="rss")#

This would produce a link like this(this would doesn’t require a special route):

/myrigs.blog.feeds/rss/xml

which would make a link to the Feeds controller(myrigs/blog/controllers/Feeds.cfc) calling its rss action and rendering the view or output as the same as in any Wheels app.

If you have a route for your BigRig application, you could also do this to get a prettier URL:

#linkTo(route="myrigs", myrig="blog", controller="feeds", action="rss", key="xml", text="Blog", class="rss")#

The resulting URL would be something like this(assuming the above routes had been set):

/blog/feeds/xml
Clone this wiki locally