Packages » Package html » Class HTMLShowIterable

Class HTMLShowIterable

Declaration:
<? class HTMLShowIterable extends HTMLTag ?>

Description:
This tag is used to iterate over on Iterable and repeat its content on each iteration. You specify the iterable in the sole key attribute of this tag which holds the template variable name of the iterable object. If the value returned by the Iterable::getNext() is non-scalar (i.e., it is an array or an object), its key-value pairs or properties will be extracted into the current variable stack so that they can be later accessed by the {%varName} construct. If the value returned is scalar, it will be available via the {%html.showiterable.value} variable in the body of this tag. The tag will also maintain current position counter in the {%html.showiterable.position} variable. If the iterable is an instance of the PaginatedIterable then the position counter will hold the actual (real) position of iterable, taking into account current page number. Besides, the following variables will be defined: {%html.showiterable.start} - the starting row number
{%html.showiterable.end} - the ending row number
{%html.showiterable.page} - the current page
{%html.showiterable.pagescount} - the total number of pages in the iterable
{%html.showiterable.total} - the total number of rows in the iterable (regardless of paging)


This tag also recognizes some pseudo-tags:
  • separator - defines a piece of markup that will be output after each iteration if there still are more items
  • ifnotempty - defines a piece of markup that will be output before the first iteration
  • ifempty - defines a piece of markup that will be output if the iterable is empty
  • ifodd - will be displayed on every odd iteration
  • ifeven - will be displayed on every even iteration


Parent Classes:
SDNode , SDElement , HTMLTag

Authors:
  • Dennis Popel

Methods:
  • isExposed()
    Returns true if the tag is exposed
  • isRepeatBody()
    Returns true if the tag requests that its body be processed again
  • onAfterBody()
    Override this to take some action after each iteration over the tag children
  • onBeforeBody()
    Override this to take some action before each iteration over the tag children. This method can return HTMLTag::SKIP_BODY to skip the body on current iteration.
  • onClose()
    This method will rewind the iterable for possible later reuse
  • onOpen()
    Override this to take some action (possibly modify own children state and own attributes) and decide whether to process the body. Please note that this method can be called multiple times on the same instance if the tag is repeated with the body of parent tag.