Let’s imagine you are in a menu component in WCM, and you want to validate if some pieces of content has a very specific value in their Keywords property; in case they have it we would like to add a featured CSS class to the rendered HTML.
Following is an example about how to use the plugin Equals in IBM WCM 8 and 8.5:
<li class="item [Plugin:Equals text1='[Property field="keywords"]' text2='featured']featured[/Plugin:Equals]">
<h3>[Property context="autofill" type="content" field="title"]</h3>
[Plugin:ifNotEmpty value="[Element context='autofill' type='content' key='thumbnail' rendition='auto']"]
[Element context="autofill" type="content" key="thumbnail" rendition="auto"]
- The plugin Equals requires two parameters: text1 and text2. In this example, we have text1=”[Property field=”keywords”]” and value2=”featured”.
- When WCM renders this HTML with meta-tags will compare text1 and text2 in orden to see if both are equals, in case of true, the CSS class featured will be added.
I hope you find useful this information and you use in your next WCM implementation, and remember, be happy with your code!