HTP

htp on-line reference : WHILE

Table of Contents
  Introduction
  License
  Tutorial
  Usage
  HTP Tags
    ALTTEXT
    BLOCK
    BLOCKDEF
    DEF
    FILE
    IF
    INC
    IMG
    IMAGEURL
    OPT
    OUTPUT
    QUOTE
    SET
    UNDEF
    UNSET
    USE, $
  > WHILE
    <!---
  History
  Wish list
  Bugs

syntax

    <[ref]def name="centered">
    <p align=center>
    <[ref]/def>

    <centered>
    This text is centered.

synopsis

WHILE is the building block for repeated processing. The basic form is shown above.

"Conditional" is either a "compare" or "is defined" operation. A compare operator is a test of the value of a macro against a literal string. If the NOT tag is present in the WHILE markup, the evaluation of the conditional is reversed:

Just as with [ref]IF you can also check for a macro's existance:

  <[ref]DEF NAME="HEADERIMG" OPTION="SRC TITLE SIZE">
    <[ref]IF size>
        <FONT SIZE=${size}>
    <[ref]/IF>
    <[ref]IMG SRC=pics/${src}>
    <[ref]USE title>
    <[ref]IF size>
        </FONT>
    <[ref]/IF>
  <[ref]/DEF>

  <HEADERIMG SRC="logo.gif" SIZE="+2" TITLE="A title">

  <HEADERIMG SRC="logo.gif" TITLE="Normal sized title">

  This will fail:
  <HEADERIMG SRC="logo.gif" ALT="Our logo" TITLE="Another title">

  Instead, use * like this:
  <[ref]DEF NAME="MYIMG" OPTION="SRC *">
    <[ref]IMG SRC="pics/${src}" $*>
  <[ref]/DEF>
   
  <MYIMG SRC="logo.gif" ALT="Our logo">

If the condition is true, the block is evaluated and afterwards the WHILE tag is evaluated again. If the '$'-operator is used in the WHILE tag it is also reevaluated on each iteration.

A loop block must be closed with the /WHILE tag.

  page source
  htp project
  htp homepage
hosted by
Sourceforge
HTML coding Powered by htp
htp on-line reference / http://htp.sourceforge.net/ref/
Authors: Jim Nelson, Jochen Hoenicke, Michael Möller.
Maintainers: Jochen Hoenicke.

Copyright © 1995–96 Jim Nelson.
Copyright © 2001–2014 Jochen Hoenicke.
Permission to reproduce and distribute this hypertext document granted according to terms described in the License section.

last updated Sat May 16, 2015