pad
Conditionals

A conditional is an expression that can do different things depending on the value of some test. Here is a template that will insert a linebreak between two images if the width of the first is greater than 200 pixels:

Max200 ()
TITLE "No wider than 200"
BODY
  WITH= variable im
        value RENDER text "Hello"
                     font-size 25
    IMAGE source im
    IF test > value1 WIDTH im
              value2 200
       then LINEBREAK
       else SHIM width 10
    IMAGE source RENDER text "World!"  
                        font-size 25
The IF operator takes three arguments. If the the test argument is true, the then argument is evaluated; otherwise the else argument is evaluated.

In this case, if the width of im is greater than 200 then a linebreak will be generated; otherwise a 10-pixel wide shim will be generated.

The SHIM operator generates a transparent image of a specified height and/or width. Such images are useful in controlling the spacing of elements on the page.



Sales: 1-888-4-VIAWEB or sales@viaweb.com.
Support: 1-617-876-9678 or support@viaweb.com.