cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: WoodyScratchpad
Date Mon, 01 Nov 2004 20:28:22 GMT
   Date: 2004-11-01T12:28:22
   Editor: TimLarson <tim@keow.org>
   Wiki: Cocoon Wiki
   Page: WoodyScratchpad
   URL: http://wiki.apache.org/cocoon/WoodyScratchpad

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -6,7 +6,46 @@
 
 Update: The implementation ideas around these (and other) concepts have moved to a separate
page WoodyRefactoring
 
-=  Types -- id/defines/extends =
+=  Macros and Types -- id/defines/extends =
+
+A macro is a definition (or blueprint) consisting of a list
+of widget definitions. When a macro is "expanded" it creates
+instances of those widget definitions in the surrounding container.
+No "macro" widget or container is created, because a macro is *only*
+a definition.
+
+So this:
+{{{
+<fd:macro define="mymacro">
+  <fd:field id="myfield">
+    ...
+  </fd:field>
+  <fd:field id="yourfield">
+    ...
+  </fd:field>
+</fd:macro>
+
+<fd:struct id="mystruct">
+  <fd:macro expand="mymacro"/>
+</fd:struct>
+}}}
+Is equivalent to:
+{{{
+<fd:struct id="mystruct">
+  <fd:field id="myfield">
+    ...
+  </fd:field>
+  <fd:field id="yourfield">
+    ...
+  </fd:field>
+</fd:struct>
+}}}
+Except that now you have a reusable macro named "mymacro"
+that you could expand in several places in your form instead
+of typing the same list of widget definition over and over
+in each place where you need them.
+
+----
 
 Create a widget:[[BR]]
 (Note: This is unchanged from current Woody/CForms.)

Mime
View raw message