Switching Panel Content with flagLogic
Flaglogic is conditional code that controls the display of panel or macro content. It uses the Flag macro to set or change a value that can then be used by other macros, like Panel Show and Panel Hide. See Working with Flags for a detailed explanation of flagLogic.
An example that detects Login page and shows related content:
The flagLogic Panel
The Set Flag macro creates the login flag and gives it a default value of false.
<ac:macro ac:name="set-flag">
<ac:parameter ac:name="name">login</ac:parameter>
<ac:parameter ac:name="state">false</ac:parameter>
</ac:macro>
The Panel Show macro can use the Confluence decorator value of login only to show its contained code on that condition.
<ac:macro ac:name="panel-show">
<ac:parameter ac:name="decorator">login</ac:parameter>
<ac:rich-text-body>
The Set Flag macro is now used to set the login flag to true.
<ac:macro ac:name="set-flag">
<ac:parameter ac:name="name">login</ac:parameter>
<ac:parameter ac:name="state">true</ac:parameter>
</ac:macro>
</ac:rich-text-body>
</ac:macro>
The Main Panel
The Panel Import macro will use the parameterflag=login
to show the login panel, containing content limited to the login and logout pages.
<ac:macro ac:name="panel-import">
<ac:parameter ac:name="panel">login</ac:parameter>
<ac:parameter ac:name="flag">login</ac:parameter>
</ac:macro>