Ok, we have a server-side solution using the ifNotEmpty plugin, which is really easy to use, let’s see an example:
[Plugin:ifNotEmpty value="[Element context='current' type='content' key='linkURL' format='url']"] <div class="ad-link"> <a href="[Element context="current" type="content" key="linkURL" format="url"]"> [Element context="current" type="content" key="linkURL"] </a> </div> [/Plugin:ifNotEmpty]
The plugin ifNotEqual requires one mandatory parameter: value (which is basically an string). In this example, we have value=”[Element context=”current” type=”content” key=”linkURL”]”.
When WCM renders this HTML with the [Element] meta-tag, it will compare the value and if it is not empty, the HTML inside the plugin will be rendered, otherwise no HTML will be generated. So, as simple as that, we validate the element value and depending on it, we generate some HTML.
I hope you find this information useful, and remember, be happy with your code!