Custom Routing

44 views
Skip to first unread message

Jonathan Creamer

unread,
Apr 1, 2011, 2:59:59 PM4/1/11
to framew...@googlegroups.com
I am slightly new to FW1, not to MVC.

I have been using Coldbox, but where I work a developer implemented something using FW1. I am loving how simple everything is and it does a lot of really great things for such a thin framework.

I notice that there are SES safe URL's based on handlers like ?action=main.index becomes /main/index, but I was wondering if there was any way to do custom routes like....

/blog/read would actually fire /main/read or ?action=main.read. 

Thanks!

Eapen

unread,
Apr 1, 2011, 3:44:25 PM4/1/11
to framew...@googlegroups.com
There are a couple of options:
1. You could do this using the mod_rewrite functionality and just enter a rule specifically for this. 
2. You can handle this in the "setupRequest" method in your Application.cfc with the help of the getSection() data (which would return "blog") and/or you can abstract it out to a customRoutes controller if you have multiple rules.
3. Since you said you are new, I just wanted to make sure you are not overlooking the ability to set "blog" as your default section and "read" as the default item which would remove the need to map /blog/read to main/index.

HTH,
Eapen.

--
FW/1 on RIAForge: http://fw1.riaforge.org/
 
FW/1 on github: http://github.com/seancorfield/fw1
 
FW/1 on Google Groups: http://groups.google.com/group/framework-one

Sean Corfield

unread,
Apr 1, 2011, 3:45:07 PM4/1/11
to framew...@googlegroups.com
Scheduled for FW/1 2.0. See issue #3 here:

https://github.com/seancorfield/fw1/issues

Jonathan Creamer

unread,
Apr 1, 2011, 10:19:43 PM4/1/11
to framew...@googlegroups.com
Thanks guys! I will stay posted...

Nathan Dintenfass

unread,
Apr 1, 2011, 10:35:37 PM4/1/11
to framew...@googlegroups.com
Another approach that would be a bit different is have your blog.cfc controller extend main (this isn't very flexible, but would allow that particular case pretty easily). 


--
Reply all
Reply to author
Forward
0 new messages