You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/11/01 21:28:22 UTC
[Cocoon Wiki] Updated: WoodyScratchpad
Date: 2004-11-01T12:28:22
Editor: TimLarson <ti...@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.)