ColdFusioning: Pronunciation \kold-fy�-zhn-ing\ Noun: The action of one that writes ColdFusion.

ColdBox and Event Default Actions - Shorter Links and SEO

When using ColdBox, you are not required to call an action inside of an event. What this means is if the framework detects an incoming event, and one doesn't exist, it will look for a method called index. If it exists, it will execute it. You can also change the name of the default action in your configuration file.

For example, lets say we have an event handler called services and we call it like this:


index.cfm/services
or
index.cfm?event=services

ColdBox will now look in the services handler for the index method. If it exists, it will treat the request as services.index. This is how your function should look, inside of services:


<cffunction name="index" returntype="void" access="public">
<cfargument name="event">

</cffunction>
</code>
This feature is wonderful on many levels. It lets you create shorter urls and also do some implicit declarations.



Related Blog Entries

Comments