[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Mode

Notes

Menulink

rss

RSS Feed Builder

RSS

more to follow (smile)

Examples

Expand
Display content on news items
Display content on news items

To display some content only on news items (blogposts), you must use the macro within a panel in the Builder theme:

Code Block

{builder-show:context=news}
{menulink:news}Back to News Summary{menulink}
{builder-show}
Expand
Display content on pages and news items
Display content on pages and news items

To show something in multiple contexts, simply separate them with commas:

Code Block

{builder-show:context=page,blogpost}
something to show
{builder-show}
Expand
Display content in edit mode
Display content in edit mode

When you change the view of something, eg. look at the normal view or editable view, the "mode" changes and you can take advantage of this to customise your theme depending on which mode is currently active. For example, if you only want to show something when it's being edited (eg. editing a page or news item), use the following:

Code Block

{builder-show:mode=edit}
something to show
{builder-show}

You can show something in multiple modes by separating them with commas:

Code Block

{builder-show:mode=edit,view}
something to show
{builder-show}
Expand
Specific modes within specific contexts
Specific modes within specific contexts

If you only want to show something in view mode within the context of a page, use the following:

Code Block

{builder-show:mode=view|context=page}
something to show
{builder-show}

When more than one parameter of the macro is specified, both parameters must match so in the example above the user must be looking at a page context in view mode.

You can specify multiple modes and contexts, for example:

Code Block

{builder-show:mode=view,edit|context=page,blogpost}
something to show
{builder-show}

In the example above, the content would be shown if the user is looking at either a "page" or a "blogpost" (news item) that must also be in either the "view" or "edit" mode.

Expand
Display content based on labels
Display content based on labels

You can display content if the current location has one or more of the specified labels:

Code Block

{builder-show:labels=my:favourite,meetings}
This stuff is either in my favourites list or something to do with meetings!
{builder-show}

Beware! Most people assume that only pages and news articles can have labels, but this is not the case. When viewing space-level pages that aren't normal content pages or news articles, for example when viewing the space labels or even space admin, this macro uses any defined space labels and even team labels.

Expand
Displaying content if a space exists
Displaying content if a space exists

You can show content only if a space exists by specifying it's space key as follows:

Code Block

{builder-show:space=ACCOUNTS}
Here's some info about the accounts space, but you'll only see this
if you have privileges to access the accounts space.
{builder-show}

As you can see, this is ideal for customising content based on which spaces a user has privilegs to access.

Expand
Display content based on existence of a page
Display content based on existence of a page

You can display content only if a specific page exists:

Code Block

{builder-show:page=My Page}
{include:My Page}
{builder-show}

In the example shown above, we only include the page if it exists. This hides the nasty error message that the include macro generates if that page does not exist. While it might seem a little strange to only show things if a specific page exists (especially considering you know the title of that page), it's extremely useful in scenarios where you are using templates and only want to show content or links if a specific page exists within the current space.

Expand
Display content if the page has a parent
Display content if the page has a parent

You can show content only if the current page has a parent page using the following notation:

Code Block

{builder-show:page=@parent}
This page has a parent page!
{builder-show}

This is useful because you often want to include additional navigation on pages that have a parent page, for example you might want to include the scrollbar macro to show a linear navigation bar.

Pages which don't have a parent are:

  • The space homepage
  • Orphan pages (pages within a space that don't have a parent)
Expand
Display content for specific page titles
Display content for specific page titles

You can display content if the current page has a specific title, for example:

Code Block

{builder-show:title=My Homepage}
Hi all, this must be my home page because it's title is "My Homepage"!
{builder-show}

This can come in handy if you are using templates to generate content and want to show something based on the page title.

Another use is if users are constantly using a page title that causes problems, for exmaple they might call a page "Meetings" and you want them to call it "yyyy/mm/dd - Meeting with x, y, z") - as such you could add this to the Title panel within theme configuration:

Code Block

{builder-show:title=Meeting}
You muppet! Use a more descriptive page title that includes
the date (and time if appropriate), type of meeting and who
was involved, etc.
{builder-show}

OK, you might not want to be that harsh in explaining to users that "Meeting" isn't a great page title and that they should use something more descriptive, but you get the general idea.

Another use is to add labels to pages based on their title:

Code Block

{builder-show:title=Home}{add-label:home-page}{builder-show}

Simply add that to the Header panel in theme config and any page called "Home" will get a label of "home-page" added to it thanks to the add-label macro. This is useful because it allows you to search all home pages within the site!

Expand
Displaying content based on metadata
Displaying content based on metadata

(warning) Alain to fill this bit in as I have no idea how it works! Also note the hierarchical nature of the checking on this.

CSS Customisation

Not applicable for this macro.

...