Since the early ColdBox 2 versions we had the ability to declare helpers for our layouts and views by creating a file right next to the view and adding the suffix Helper to it. This would allow the framework to bind the two templates together at run-time. This is a great way to provide further separation by convention. However, there was no way to affect layouts and views globally. You only had the global application helper which injected functions and variables to handlers, layouts and views.
In ColdBox 4 you have a setting viewsHelper
which is a template that will be injected and bonded to any layout/view that is rendered. This means that finally you have a template that can be globally available to any view/layout in your system. This is a great way for you to add your own functions for things like i18n, localization, and much more.
coldbox = { viewsHelper = "includes/helpers/ViewHelper.cfm" };
Enjoy!
Add Your Comment