CMS_INPUT_DOM - Listoutput without spanning 'p' tags

Crownpeak employee
Crownpeak employee
3 7 2,300

You can use lists within the CMS_INPUT_DOM component. Unfortunately these lists have to be defined within a section formattemplate, which puts unneeded tags within the output


To get rid of these unnecessary tags, you can put the following code within all of your section formattemplates and in the ul-formattemplate:


$CMS_IF(!#content.toString.trim.equals(""))$$CMS_SET(listLayer,0)$$CMS_SET(startTag,"<p>")$$CMS_SET(endTag,"</p>")$$CMS_SET(output,startTag + #content + endTag)$$CMS_VALUE(output.replaceAll(startTag+endTag,""))$$CMS_END_IF$




$CMS_IF(!#content.toString.trim.equals(""))$ --> checks, if the section contains more then just white-spaces. Otherwise it will not be rendered.
$CMS_SET(listLayer,0)$ --> defines a counter to check, if the actual list is the outer list. Otherwise we do not need to eliminate the outer tags.
$CMS_SET(startTag,"<p>")$$CMS_SET(endTag,"</p>")$ --> definition of the tags which should be used for the appropriate section. You have to adjust the content 😉
$CMS_SET(output,startTag + #content + endTag)$$CMS_VALUE(output.replaceAll(startTag+endTag,""))$ --> Eliminates all empty (not needed) tags of the section formattemplate [in the example <p></p>]

Tested with FirstSpirit Version 4.2R2

Version history
Last update:
‎07-13-2010 05:43 AM
Updated by: