A 1 minute read, written by Jon
June 19, 2013
Have you ever come across a situation where you need to hide certain structural elements of your website due to the fact that the content author may or may not place content in that area?
This can be a common issue when developing a website intended for use in a Content Management System like OpenText there is a need to hide these elements or markup on the site when areas lack content. In larger sites with many contributors this becomes more of an issue and putting in automated checks for areas lacking content becomes more important.
OpenText comes with a tag just for this purpose called the IoRangeConditional tag. This allows you to wrap areas that contain a Standard Field or something similar and the system will output the contents of the tag only when it has a value associated with it. Here is a common example of conditionally showing a title for a page if the value exists:
<!IoRangeConditional> <%stf_title%> <!/IoRangeConditional>
Now what if you have multiple values? Or more complex markup you need to conditionally show? While this tag handles simple examples quite elegantly, it can fall short of more complex uses. This is not an issue as we can leverage the power of RenderTags to solve our problem. Here is an example of checking a Container for contents, and showing the contents and a wrapper div if it holds a value:
<%con_myContainer%>
This simply checks the output of the Container myContainer, and if there is a value of any kind, outputs the htmltext value which holds the output. Now that we are using a RenderTag block we can also utilize the else in this conditional to put in some alternate values for the case where there is no value.
This is just a simple example of what can be done in your OpenText Content Classes to handle these sorts of situations and with the prominence of Responsive Design, a practice where front end markup can be sensitive to these types of issues, these situations will arise more and more often.
Source: Now you see it, now you don’t
© copyright 2013 by yellowpencil