[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

If you have need of

Excerpt

switching layouts dependant on the context of the page being viewed

, then you can achieve this through the {builder-show} and {builder-hide} macros, when used alongside the {use-layout} macro.

If for example you had a layout with no sidebars, but wanted to display the quick-help guide in the right-sidebar when in edit mode without needing to include the right-sidebar for general pages.

To do this, you would create a child layout to your main layout, lets call it EDITLAYOUT. In this child layout you then switch the right sidebar on and ensure it contains a copy of the {builder-infopanel} macro, and save your changes.

Then move back to the original (parent) layout and edit one of the panels, ideally the first one down the screen, so if you have the header panel switched on then use that, followed by the menu panel, navigation panel etc...

You will then need to enter code similar to this:

Code Block
{builder-show:mode=edit}{use-layout:EDITLAYOUT}{builder-show}

This concept can be extended using the functionality of the builder-show/hide macros to select the layout based on any number of things, ranging from the user-agent (aka browser/platform) of the person viewing the page, to the kind of page being viewed, the user's permissions on that page, groups, labels, page title, parent page title, orphaned pages, for example:

Display blackberry layout based on browser

Code Block
{builder-show:user-agent:BlackBerry}{use-layout:BLACKBERRY}{builder-show}

Display layout based on content age

Code Block
{builder-show:olderthan=3m}{use-layout:OLDNEWS}{builder-show}

Display layout based on parent page title

Code Block
{builder-show:title=forum|recurse=true}{use-layout:FORUM}{builder-show}

etc...

If you are unsure of the parameters you need for your use-case, please create an issue through tracker