= Using Broadcasts, Results and Views in Scaffolds =
As we've seen in "How To Add A Scaffold," a single scaffold tag simply serves to define multiple event handlers. In order to keep the Model-Glue XML format easy to learn, the scaffold tag supports the same child tags (broadcasts, views, and results) as an event handler tag.
Any broadcasts, views, or results tags added beneath a scaffold tag are applied to all event handlers a given scaffold creates. (To learn more about creating broadcasts, views, and results see the Quickstart guide).
This allows us to extend the functionality of scaffolds in powerful ways.
For example, to apply the sitewide template from the Model-Glue Application Template to all of the event handlers created by a given scaffold, we can simply add a result tag:
{{{
}}}
By splitting the types of scaffolds created amongst multiple scaffold tags for the same object, we can even apply message broadcasts to specific scaffold-generated event handlers.
In a given application where anyone can view contacts but only administrators can update contacts, we could use the following XML in !ModelGlue.xml to protect the edit, commit, and delete event handlers from unauthorized access (assuming a message listener for "!UserMustBeAdministrator" performs security functionality and adds a result named "!SecurityViolation" in the event of bad access):
{{{