DML2  v1.0.1
Introduction to DML2
Getting Started
Files and Directories
Custom Tags
File Output
Creating Objects
Rendering and Scope
Object Execution
Rendering Arrays
Automatic Tags
Release Notes
<( Rendering and Scope )>

You've already learned that with DML2 tags, when you call them (like this: <(someTag)>), it inserts the (parsed) code that you defined the tag to include. Objects and members can also be referenced in a similar way. If you called a value like <(someDate.month)>, it will return the property's text (as well as parsing DML2 elements from it).

Now you're probably wonder what would happen if you referenced an entire object, not just a property. This is where a render definition comes into play. The render definition defines what will be returned when you type something like <(someDate)>. You can make a render declaration by typing render followed by space, the object type, space, and an opening brace ({). It's actually pretty similar to a tag definition.

render Date {
Date: <(month)> <(day)>, <(year)>

The first thing you'll notice is that I didn't type anything like <(>, the reason for this is that DML2 has a sense of scope. This means that when you're in a Date object, you can access the Date members as though they were local. If I had wanted to access members of the Time member contained within Date, however, I would have to type something like <(timestamp.seconds)> (since the Time members are not local).

Back to the render definition. Now when I type <(someDate)>, the text that I defined up above will be inserted at that location, using the instances own members. This is because someDate is of type Date.
©2002 Jared Krinke. ((( Revolution )))