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
<( Object Execution )>

Execution declarations are very similar to render declarations, except that you replace the word render with execute. Inside of an execute declaration, however, the similarities end. An execute definition is a block of DML2 commands like what you have an object of a given type execute. The reason for this is you might have an array of Page objects. These objects each represent what will end up being a static file that DML2 outputs. Rather than render each of them to a file or something like that, you can simply execute them.

object Page {
      val title
      val content

execute Page {
      output "<(title)>.html" {

Page index
Page news
# Assign stuff to index and news

As you can probably gather from the example above, execution gives you the ability to output files based on DML2 objects, so that you don't have to explicitly define output files. This also makes it easy to keep pages of similar types consistent without changing a bunch of files.

You may think that these statements will execute themselves automatically, but practice has shown that this is horribly inefficient, so DML2 now requires you to explicitly tell objects to execute. This is simple enough to do, however:

execute index
execute news

In the future (that is, after you read the next few sections), you'll know about arrays. You can execute entire arrays at a time (something I consider to be very useful). You may want to look at this again once you've read up on arrays.

execute pages[]
©2002 Jared Krinke. ((( Revolution )))