(CB newbie here...)
Say I have a page whose action is users.list, which does what it says.
Aross the top is a menu whose contents changes depending on your
location in the app and your user rights, and down the side is a box
with the latest 5 blog posts, the latest 5 tweets, and some ads. Those
same items appear on all the pages in this section of the app.
Each of those sideshow items could be thought built by the controller
calling different services to grab the relevant data, which the layout
then displays. You could use an interceptor or some other common hook
point to grab the model data on all pages that use that layout (I
think).
But that's not a very cohesive strategy. Really, I'd rather think of
each of those items as having its own mini-MVC cycle, where a
controller gets appropriate data from models and steers it to the
appropriate vars for a view to pick up. You could think about it as
MenuController, MenuService (model), and MenuView, and the same for
Blog, Tweets, and Ads.
These secondary MVCs aren't being used as the main action for a page
(that's something else), but as widgets that appear in different
locations and combinations on multiple pages. They might be the
central action on a different page, probably with different parameters
and views (the site's blog home page shows more posts in more detail,
for instance), but here they're part of the furniture surrounding the
main action. You should be able to reuse them with a single
parameterized call, rather than separate invocations of model and view
calls.
Can ColdBox modules be used like this? Are there docs and examples
somewhere? If not, and before there were modules, how did people
implement this kind of functionality?
Thanks.