Hiding elements on a posting in presentation and authoring mode

A very convenient way to achieve this but unfortunatelly not very good documented is used in the Default Console shipped with MCMS.

To hide items (e.g. a Placeholder Control) in Presentation mode use the following code in your template ASPX file:

<cms:AuthoringModeContainer id=”hiddenInPresentation1″ runat=”server”>
…controls and html not to be shown in Presentation mode…
</cms:AuthoringModeContainer>

To hide items in authoring mode use the following code:

<cms:PresentationModeContainer id=”hiddenInAutoringMode” runat=”server”>
…controls and html not to be shown in Authoring mode…
</cms:PresentationModeContainer>

For the PresentationModeContainer there is even more granurity available to differentiate between published and unpublished mode:

<cms:PresentationModeContainer id=”hiddenInAutoringAndUnpublishedMode” runat=”server” mode=”Published”>
…controls and html not to be shown in Authoring and Unpublished mode…
</cms:PresentationModeContainer>

<cms:PresentationModeContainer id=”hiddenInAutoringAndPublishedMode” runat=”server” mode=”Unpublished”>
…controls and html not to be shown in Authoring and Published mode…
</cms:PresentationModeContainer>

Something similar exists for the AuthoringModeContainer to differentiate between AuthoringNew and AuthoringReedit. I’m not sure if there are many scenarios where this can be used but just to complete the list:

<cms:AuthoringModeContainer id=”hiddenInPresentation1″ runat=”server” mode=”AuthoringNew”>
…controls and html not to be shown in Presentation mode and AuthoringReedit…
</cms:AuthoringModeContainer>

<cms:AuthoringModeContainer id=”hiddenInPresentation1″ runat=”server” mode=”AuthoringReedit”>
…controls and html not to be shown in Presentation mode and AuthoringNew…
</cms:AuthoringModeContainer>

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.