My day to ask obvious questions

47 views
Skip to first unread message

eric...@gmail.com

unread,
Apr 11, 2021, 7:04:43 PM4/11/21
to CFWheels
Having not used 2.x I'm a bit confused at some of the behavior I'm seeing. 

I'm trying to use a fairly straightforward linkto 

#linkTo(text="#tournaments.tournamentSeasonName#", action="detail")#

I've played with this multiple different ways (and yes - I've reloaded and verified that it does indeed reload).

The result is just 127.0.0.1:8888/index.cfm 

I've also tried the following:

#linkTo(text="Log Out", controller="home", action="logout")#<br/>
#linkTo(text="View Settings", action="settings", params="show=all&;sort=asc")#

Both result as follows:


Why isn't the action showing up?  Is there some sort of special routing I need to do that isn't required in 1.4.x?


Tom King

unread,
Apr 12, 2021, 4:01:15 AM4/12/21
to CFWheels
Routes in 2.x are the single biggest change. I'm assuming you've migrated all your routes from addRoute() to the new mapper() syntax?
There are still a few quirks (https://github.com/cfwheels/cfwheels/issues/1046) but generally, the key thing is include the route name in the linkTo() as it's more efficient (and more consistent in behaviour)
i.e 
assuming you have something like 
.get(name="logout", to="home##logout")
in your routes file, then this:
#linkTo(route="logout", text="Log Out")# 
should work nicely.

Basically a single route name works a load better than having to specify both controller and action manually. 
T
Reply all
Reply to author
Forward
0 new messages