Appendix B: Webiva Design API: Value Tags

Value tags are the most common type of tag available in the system, their default job is to display a piece of content.

Usage as Single tags

If you have a value tag such as:

    <cms:description>

The simplest way to use it is just as a single tag:

   <cms:description/>

What content this adds on the page depends on the tag and the paragraph, but you can usually figure it out from the context. In the case of a blog paragraph it will be the content of the post. The single tag format has a couple of options you can use:

  <cms:description limit='250' omission="..." />

Will convert the content to text and show the first 250 characters, with the additional text being replaced with the value of the omission attribute. If omission is omitted, the default value of ”…” will be used.

There are also 4 options to escape value tags:

  • <cms:description escape='value' /> - which will escape the content for use in an attribute.
  • <cms:description escape='javascript'/> - which will escape the content for use in a <script> tag
  • <cms:description escape='javascript_value'/> - which will escape the content for use in javascript in a attribute.
  • <cms:description escape='html'/> - which will escape the content and convert any tags into their text representation

Usage as Block tags

Using value tags blocks, with open and close versions of the tag, allows you to conditionally show content.

If you want to conditionally wrap the value of the tag only if it exists, you can use the tag in block form along with a <cms:value/> tag, such as:

 <cms:description> This is the body<br/>: <cms:value/> </cms:description>

The text “This is the body” will only appear when the body isn’t blank.

Usage additional block options

You can pass additional options into value tags when using them as block tags to have them conditionally expand or not expand

  • <cms:description equals='val'> ..</cms:description> - will expand only when body equals ‘val’
  • <cms:description not_equals='val'> ..</cms:description> - will expand only when body does not equal ‘val’
  • <cms:description contains='a,b,c,d'> ..</cms:description> - will expand only when body is one of ‘a’,’b’,’c’, or ‘d’
  • <cms:description min="7"> ..</cms:description> - will expand only when body is a number and greater than 7
  • <cms:description max="7"> ..</cms:description> - will expand only when body is a number and less than 7
  • <cms:description link="true"> ..</cms:description> - will turn the value of body into an href and put the content of tag into the link body.