Index: openacs-4/packages/acs-templating/www/doc/tagref/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/tagref/index.html,v diff -u -r1.1.1.1.4.1 -r1.1.1.1.4.2 --- openacs-4/packages/acs-templating/www/doc/tagref/index.html 7 Aug 2003 21:51:44 -0000 1.1.1.1.4.1 +++ openacs-4/packages/acs-templating/www/doc/tagref/index.html 7 Aug 2003 22:11:36 -0000 1.1.1.1.4.2 @@ -44,9 +44,10 @@
  • <group>
  • <grid>
  • <list> -
  • <if> -
  • <switch> +
  • <if>,<elseif>,<else> +
  • <switch>,<case>,<default>
  • <include> +
  • <include-optional>
  • <property>
  • <noparse>
  • <master> Index: openacs-4/packages/acs-templating/www/doc/tagref/switch.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/tagref/switch.html,v diff -u -r1.1.4.1 -r1.1.4.2 --- openacs-4/packages/acs-templating/www/doc/tagref/switch.html 7 Aug 2003 21:51:44 -0000 1.1.4.1 +++ openacs-4/packages/acs-templating/www/doc/tagref/switch.html 7 Aug 2003 22:11:36 -0000 1.1.4.2 @@ -1,83 +1,84 @@ - Templating System Tag Reference: switch + Templating System Tag Reference: Switch - -

    switch

    +

    Switch

    Templating System : Designer Guide : - Tag Reference : switch + Tag Reference : Switch

    Summary

    -

    The switch tag is used to output a template section only when -a certain condition is met. You use it when you have several options to test, -thus avoiding the need for successive <if> <else> blocks.

    +

    The switch tag is used to output one of n-sections when the switch variable matches one of the n-case statements. A default section can also be output if none of the n-case statements matches the switch variable.

    Usage Examples

    -
    -<switch flag=exact @some_var@>
    -    <case value="a">
    -        A was selected
    +<switch @x@>
    +    <case value="Fred">
    +         Hello Fred.
         </case>
    -    <case value="b">
    -        B was selected
    +    <case value="Greta">
    +         Hello Greta.
         </case>
    +    <case value="Sam">
    +         Hello Sam
    +    </case>
         <default>
    -        Not a valid selection
    +         I don't recognize your name.
         </default>
     </switch>
    -
    -<switch flag=glob @some_var@>
    -    <case value="a*">
    -        A value starting with "a" was selected. 
    +
    +

    Tcl-equivalent flags have the same meaning as in the tcl-switch statement. Supported flags include exact, glob, and regexp.

    +
    +<switch flag=glob @x@>
    +    <case value="F*">
    +         Hello Fred.
         </case>
    -    <case value="b?">
    -        A value of "B" followed by any other character was selected. 
    +    <case value="G*">
    +         Hello Greta.
         </case>
    -    <case value="[A-Za-z]">
    -        A character between capital A and capital Z, lowercase a and lowercase z was selected. 
    +    <case value="H*">
    +         Hello Sam
         </case>
         <default>
    -        Not a valid selection
    +         You are in the section for people whose names start with F, G, or H.
         </default>
     </switch>
    -
    -<switch flag=regexp @some_var@>
    -    <case in "foo" "bar" "baz">
    -        Foo, Bar or Baz was selected
    +
    +

    +Case tags also have an alternative form for matching a list of items.

    +

    +

    +<switch @x@>
    +    <case in "Fred" "Greta" "Sam">
    +         Your must be Fred Greta or Sam, but I'm not sure which one.
         </case>
    -    <case value="a.+">
    -        A was selected
    -    </case>
    -    <case value="b.+">
    -        B was selected
    -    </case>
    -    <case value="c.+">
    -        C was selected
    -    </case>
         <default>
    -        Not a valid selection
    +         I don't recognize your name.
         </default>
     </switch>
     
    +

    +

    Notes

    -

    Notes

    - - + +
    templating@openacs.org