| Version 3 (modified by davidhenry@…, 17 years ago) |
|---|
- Model-Glue XML Reference
- <after>
- <argument>
- <before>
- <broadcasts>
- <config>
- <controller>
- <controllers>
- <event-handler>
- <event-handlers>
- <event-types>
- <event-type>
- <include> (child tag of <modelglue>)
- <include> (child tag of <views>)
- <message>
- <message-listener>
- <modelglue>
- <result>
- <results>
- <scaffold>
- <setting>
- <value>
- <views>
Model-Glue XML Reference
All Model-Glue applications are configured via at least one XML file that follows the "Model-Glue" XML format described in this document.
<after>
Part of a typed event. See How To Use Typed Events for more information.
Attributes
None
Child Tags
- <broadcasts>
- <results>
- <views>
<argument>
A string value passed to a function registered to listen for a given message as part of the function's Event argument. Its value can be acessed through the Event API's getArgument() method.
Attributes
- Name (Required) - Defines the name of the argument.
- Value (Required) - Defines the value of this argument.
Child Tags
None
<before>
Part of a typed event. See How To Use Typed Events for more information.
Attributes
None
Child Tags
- <broadcasts>
- <results>
- <views>
<broadcasts>
Contains a list of <message> tags. The <message> tags will be broadcast in the order in which they are defined.
Attributes
None
Child Tags
- <message>
<config>
Used in Model-Glue XML fragments to define additional settings and by legacy Model-Glue 1.x applications to define settings.
This tag is largely unused in Model-Glue 2.0+!
Attributes
None
Child Tags
- <setting>
<controller>
Defines a CFC that will act as a Controller in the application.
Attributes
- Name (Required) - A unique name for this controller. A Model-Glue application where multiple controllers are added with the same name will currently confuse the framework (as of 2.0 Beta 1). This will eventually be resolved.
- Type (Required) - The CFC to use for a controller in the same format that you'd use in a CreateObject() call, such as "myapplication.controller.MyController"
Child Tags
None
<controllers>
Contains a list of <controller> tags.
Attributes
None
Child Tags
- <controller>
<event-handler>
Defines an event or "page" in the application.
Attributes
- Name (Required) - A unique name for the event handler. This defines how the event will be accessed through the URL, such as "index.cfm?event=MyEvent".
If an <event-handler> is added whose NAME attribute is in use by another event-handler, it will overwrite the previous event-handler, except in the case of the predefined modelglue.onRequestStart, modelglue.onQueueComplete, and modelglue.onRequestEnd event-handlers. In this case, any messages, views, or results defined will be added to the predefined event handlers.
- Access (Optional, defaults to "public") - If set to "private," the event handler cannot be accessed directly through the URL.
Child Tags
- <broadcasts>
- <results>
- <views>
<event-handlers>
Contains a list of child tags that define the events in the application.
Attributes
None
Child Tags
- <event-handler>
- <scaffold>
<event-types>
Defines a collection of event types. See How To Use Typed Events for more information.
Attributes
None
Child Tags
- <event-type>
<event-type>
Defines a custom event type. Makes applying configuration selectively to specific events quite easy. See How To Use Typed Events for more information.
Attributes
1. Name (Required) - A unique name for the event type.
Child Tags
- <before>
- <after>
<include> (child tag of <modelglue>)
Defines a path to another Model-Glue XML file to include.
Useful for breaking up large Model-Glue XML files into multiple fragments.
Attributes
- Template (Required) - The path to the file to include. ColdFusion will use expandPath() to turn this into an absolute path to a file.
Child Tags
None
<include> (child tag of <views>)
Defines a .CFM template to <cfinclude>, creating HTML that will be viewable by the user.
Model-Glue will search the mappings listed in the ViewMappings setting (defined in the application's ColdSpring.xml file) in order, searching for the template defined in the TEMPLATE attribute.
Attributes
- Name (Required) - The name by which the rendered content will be known in the ViewCollection
- Template (Required) - The filename of a .CFM template inside one of the directories in the ViewMappings setting
- Append (Optional, default = "false") - If an include by this NAME has already been rendered, should the content from this include be appended to the existing content or should it overwrite the existing content? (False will overwrite, True will append.)
Child Tags
- <value>
<message>
Defines a message to be broadcast during the execution on an event handler. Messages are broadcast in the order in which they are defined.
Attributes
- Name (Required) - The name of the message. The same message may be broadcast multiple times during a single event handler, with or without different sets of arguments. Any message-listener tags whose MESSAGE attribute value matches the value of attribute will execute the function registered via their FUNCTION attribute.
Child Tags
- <argument>
<message-listener>
Relates a <cffunction> inside of a Controller CFC to a message that is broadcast via a <message> tag inside of an <event-handler>'s <broadcasts> block.
Attributes
- Message (Required) - The name of a message for which to listen, defined by the <message> tag's NAME attribute.
- Function (Required) - The name of a public <cffunction> on the related Controller CFC to execute whenever a <message> is broadcast whose NAME attribute matches the value of the MESSAGE attribute
Child Tags
None
<modelglue>
Declares the root of a Model-Glue XML file.
Attributes
Child Tags
- <controllers>
- <event-handlers>
- <include>
- <config>
<result>
Defines an additional event-handler to execute as part of the current request. Can use the NAME attribute to determine whether or not a certain result should be executed, and the REDIRECT attribute to abort the current request and redirect to a different event handler.
Model-Glue will search the mappings listed in the ViewMappings setting (defined in the application's ColdSpring.xml file) in order, searching for the template defined in the TEMPLATE attribute.
Attributes
- Do (Required) - The NAME attribute of an event handler to add to this request.
- Name (Optional) - If not set or set to an empty string, the event handler declared in the DO attribute will always be added to the request. If not empty, the event handler declared will only execute if a function in a Controller CFC uses the addResult() method of the Event API to add a result with the value of the NAME attribute.
- Redirect (Optional, default = "false") - If true, a redirect will immediately redirect the entire request to the event handler declared in the DO attribute. All state value will be maintained if session is enabled.
- Append (Optional, default = "") - Used to define a list of value names (from the viewstate) that should be appended to the URL.
Example: If APPEND is set to articleId and DO is set to article, the redirect URL would be index.cfm?event=article&articleId=[value of articleId].
Advanced, rarely used attributes:
- PreserveState (Optional, default = "true") - If set to false and REDIRECT is set to true, the all state values will removed before redirecting to the event handler declared in the DO attribute
- Reset (Optional, default = "false") - If set to true, any previously declared results of the same name will be erased. This is only useful for redefining results added by scaffolds.
Child Tags
None
<results>
Contains a list of <result> tags.
Attributes
None
Child Tags
- <result>
<scaffold>
Automatically defines and creates user interface for listing and editing data from a database table. By default, creates object.list, object.view, object.edit, object.commit, and object.delete event-handlers, where object is the value of the OBJECT attribute. This list of event-handlers to create is controlled by the TYPE attribute.
Attributes
- Object (Required) - The name of the database table to scaffold
- Type (Optional, defaults to "list,view,edit,commit,delete") - What types of event-handlers to create
Child Tags
- <broadcasts>
- <results>
- <views>
<setting>
Used in Model-Glue XML fragments to define additional settings and by legacy Model-Glue 1.x applications to define settings.
This tag is largely unused in Model-Glue 2.0+!
Special Behavior
A setting tag with a NAME attribute value of "viewMappings" will append its value to the list of existing viewMappings.
A setting tag with a NAME attribute value of "beanMappings" will (ColdSpring) load the file defined into the BeanFactory or (ChiliBeans) append its value to the list of existing beanMappings.
All other settings are simply set.
Attributes
- Name (Required) - The name of the setting to set
- Value (Required) - The value of the setting
Child Tags
None
<value>
A string value to set into the ViewState before the .CFM template in the current include is rendered. Its value may be accessed through the ViewState object in the View API.
Attributes
- Name (Required) - Defines the name of the argument.
- Value (Required) - Defines the value of this argument.
- Overwrite (Optional, default = "true") - If set to true, this value will overwrite an existing same-named value in the ViewState.
Child Tags
None
<views>
Contains a list of <include> tags. The <include> tags will be run in the order in which they are defined.
Attributes
None
Child Tags
- <include>
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)