Conditional checking tags (Utility Plugins) in Presentation Templates - WCM8


At last IBM has introduced the tags to check element value dynamically and generate markup in presentation templates. It was always challenging to do this in earlier release as condition checking only possible through the Javascript.

Following are different conditional  and/or utility plugin tags introduced


1.       Comment plugin  : This will not generate the client markup (just like JSP Comments <%-- --%>).
[Plugin:Comment] This is a comment [/Plugin:Comment]

2.       Equals Plugin: Generate the markup between the tags

[Plugin:Equals text1="Success" text2="[Element context='current' type='content' key='testoption']"]
       Option selected is "success", [Element context="current" type="content" key="body"]
[/Plugin:Equals]

3.       Not Equals Plugin

[Plugin:NotEquals text1="Success" text2="[Element context='current' type='content' key='testoption']"]
       Option selected is not success i.e fail, link to <a href="[Element context="current" type="content" key="testfileresource"]">Guidlines</a>
[/Plugin:NotEquals]

4.       Matches Plugin

[Plugin:Matches pattern=".*success*." text="[Element context='current' type='content' key='testoption']"]
      Option selected is matches to "success"
[/Plugin:Matches]

         Negative match

[Plugin:Matches pattern=".*success*." negative-match="true" text="[Element context='current' type='content' key='testoption']"]
      Option selected is not matched to "success".i.e failed.
[/Plugin:Matches]


5.       Locale Plugin :  Markup between the start and end tags is rendered only if the preferred supported locale is determined.

Displays language  [Plugin:Locale]         

Displays language in specified format  [Plugin:Locale pattern="{language}_{country}"]    

Display markup based between start and end tags
[Plugin:Locale acceptLanguage="da,fo;q=0.8,fi;q=0.6,is;q=0.4,no;q=0.2,sv;q=0.2" printLocale="false"]
<div>This markup is displayed only if the current context supports a locale
that represents one of the specified Nordic languages.</div>
[/Plugin:Locale]


[Plugin:Matches pattern="es(.*)" text="[Plugin:Locale]"]
<div>This markup appears only if the preferred supported locale in the current context represents a Spanish language. Neither the country code nor the variant are important as ls the language code of the locale is "es".</div>
[/Plugin:Matches]

6.       ThemeCapability Plugin

[Plugin:ThemeCapability]

Example of a string that is returned when the [Plugin:ThemeCapability] tag is rendered on a page that uses the full profile theme:
{analytics_aggregator=8.0, portal.livetext.hcard=8.0, widget_container=2.1, active_site_analytics=8.0, portal.livetext.action=8.0, open_ajax_hub=2.0, dojo=1.7, mashups.enabler=3.0.0.1, content_mapping.picker=cp_tagging_rating=8.0, oneUI=3.0.1, portal.livetext.adr=8.0, mashups.builder=3.0.0.1, federated_documents.picker=8.0, portal.livetext.c2a=8.0}

7.       ToolbarState Plugin : ToolbarState plug-in to retrieve the state of the site toolbar that is provided with the Portal 8.0 theme

[Plugin:ToolbarState]


    More details and options can be found from the product documentation.


References/Resources

NOTE: Local Plugin didn’t show up at the when I am testing in my local and also there is a additional entry that is called tags.

2 comments: