Now, every major programming language comes with the capability to include inline comments in the code. And DTML lets you include meaningful comments in your code via the <dtml-comment> tag. Take a look at the tree example, now rewritten with lots of comments.
<dtml-tree branches_expr="objectValues()" sort="id" single="1">
<dtml-comment>
check if the current item in the tree is a
folder</dtml-comment>
<dtml-if
"meta_type=='Folder'">
<dtml-comment>If folder, just display the id</dtml-comment>
<img
src="<dtml-var icon>" >
<dtml-comment>check if current item has been expanded</dtml-comment>
<dtml-if
tree-item-expanded>
<dtml-comment> if expanded, display the id of the object
in
bold</dtml-comment>
<b><dtml-var getId></b>
<dtml-else>
<dtml-var
getId>
</dtml-if>
<dtml-else>
<dtml-comment>if not folder, hyperlink
the object so that it can be
directly accessed by the user</dtml-comment>
<img
src="<dtml-var icon>">
<a href="<dtml-var tree-item-url>">
<dtml-var
getId>
</a>
</dtml-if>
</dtml-tree>
If you're planning to make your code publicly available on the Internet, a comment
is a great way to tell members of the opposite sex all about yourself - try including your phone number for optimum results.