Package qm :: Package external :: Package DocumentTemplate :: Module DT_If
[hide private]
[frames] | no frames]

Module DT_If

source code

Conditional insertion

Conditional insertion is performed using 'if' and 'else'
commands.

To include text when an object is true using the EPFS
format, use::

   %(if name)[
        text
   %(if name)]

To include text when an object is true using the HTML
format, use::

   <!--#if name-->
        text
   <!--#/if name-->

where 'name' is the name bound to the object.

To include text when an object is false using the EPFS
format, use::

   %(else name)[
        text
   %(else name)]

To include text when an object is false using the HTML
format, use::

   <!--#else name-->
        text
   <!--#/else name-->

Finally to include text when an object is true and to
include different text when the object is false using the
EPFS format, use::

   %(if name)[
        true text
   %(if name)]
   %(else name)[
        false text
   %(else name)]

and to include text when an object is true and to
include different text when the object is false using the
HTML format, use::

   <!--#if name-->
        true text
   <!--#else name-->
        false text
   <!--#/if name-->

Notes:

- if a variable is nor defined, it is considered to be false.

- A variable if only evaluated once in an 'if' tag.  If the value
  is used inside the tag, including in enclosed tags, the
  variable is not reevaluated.


Version: 1069

Classes [hide private]
  If
  Unless
  Else
Variables [hide private]
  __doc__ = '''Conditional insert...
  __rcs_id__ = '$Id: DT_If.py 1069 2008-11-13 21:55:43Z stefan $'
  __package__ = 'qm.external.DocumentTemplate'
Variables Details [hide private]

__doc__

Value:
'''Conditional insertion

       Conditional insertion is performed using 'if' and 'else'
       commands.

       To include text when an object is true using the EPFS
       format, use::

...