Link Search Menu Expand Document

not_empty

The not_empty tag can be used to find out whether or not an editable region contains any value.

It returns a ‘1’ if the variable representing the editable region contains some value (i.e. is not empty) else it returns a ‘0’.
This property makes it possible to use it with conditional tags, like if and else.

<cms:if "<cms:not_empty my_content />" >
   .. do something..
</cms:if>

The snippet above, where we are checking if the editable region named my_content contains any value, could have been written in the following simpler manner -

<cms:if my_content >
   .. do something..
</cms:if>

- however, if the editable region is of type richtext, the CKEditor sometimes inserts some spurious <BR /> or empty <P> tags into it even if nothing is entered into the editable region by the user. This will cause the simple test above to fail with richtext types. The not_empty strips off all HTML tags from the variable it is testing and then returns the result, thus making it useful for such cases.

Parameters

This tag takes no parameters.

Variables

This tag is self-closing and does not set any variables of its own.