Blog

Brad Wood

July 03, 2012

Spread the word


Share your thoughts

 

Everyone should be familiar with the setView method in the event object which is used for a handler's action to tell the framework which view file should be used to render the event:

 

event.setView(view="general/index");

 

What you may not realize is that calling setView() is optional.  If you don't explicitly set a view file, ColdBox will then look for the view according to the executing event's syntax. So if the incoming event is called general.index and no view is explicitly defined in your handler, ColdBox will look for a view in the general folder called index.cfm.

 

So this event URL:

http://www.example.com/index.cfm/general/index

 

Would default to the following view:

<web root>/views/general/index.cfm

 

Even if you don't use implicit views, it is recommended that your folder structure and naming conventions match beween your handlers and views for uniformity.

 

More info here: http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Implicit_Views

 

P.S. If you depend on implicit views, remember that ColdBox lower cases the view name by default.  To switch this behavior, use the caseSensitiveImplicitViews setting.

 

Add Your Comment

Recent Entries

BoxLang 1.0.0 Beta 17 Launched

BoxLang 1.0.0 Beta 17 Launched

In this release, we've introduced the exciting addition of websockets support to BoxLang through the powerful SocketBox module. This enhancement is not limited to our CommandBox Runtime but also extends to our MiniServer runtime, creating a more dynamic and efficient framework for real-time communication. For an in-depth introduction to these features, please visit our community post here.

Additionally, we've implemented several new features and improvements. We've also improved the system startup process by adding version and build date information to the MiniServer startup output (BL-607).

Luis Majano
Luis Majano
October 04, 2024
Adobe CFSummit 2024 Recap | Ortus Solutions

Adobe CFSummit 2024 Recap | Ortus Solutions

A huge thank you to everyone who visited our booth! We had the pleasure of engaging in meaningful conversations about Modern CFML and ColdFusion development, sharing insights, and exploring exciting new ideas. Visitors also got a chance to participate in some fun activities and win fabulous prizes, including our customized t-shirts, which were a huge hit!

Maria Jose Herrera
Maria Jose Herrera
October 02, 2024
BoxLang September Newsletter

BoxLang September Newsletter

Welcome to the September edition of the BoxLang Newsletter! This month has been packed with exciting updates, new features, and enhancements that continue to shape BoxLang into a robust and versatile programming language. In this edition, we highlight the latest beta releases, new integrations, and key features that have been introduced.

Maria Jose Herrera
Maria Jose Herrera
October 01, 2024