This documentation has moved. For the most recent documentation, check out https://docs.adaptavist.com. Please update your bookmarks and links.

Skip to end of metadata
Go to start of metadata

ThemeBuilder Macro - Import

import

Imports content from another source and renders it from the perspective of the current page.

Categories: development

Usage

This macro imports the contents of another page into the current page. This macro differs from the regular confluence include macro in that the content is rendered in the context of the current page rather than the source page.

This subtle difference is particularly useful when you want to store re-usable chunks of menu items on a page - because those menu items may have specific privilege requirements depending on where they are used, they needed to be rendered in the context of the current page in order to always show the correct values and links.

The security restrictions of the source page are honoured - if the user is not allowed to see the source page, this macro won't be able to import it.

Storage Format

<ac:macro ac:name="import">
   <ac:parameter ac:name="parameter">value</ac:parameter>
</ac:macro>

Wiki Markup

{import:parameter=value}

Parameter

Name

Description

Type

Default

Required

import

Import From

The name of the page to import, or the skin-resource in SKINID::RESOURCE format (the extension will be determined by the import macro and will define how it is rendered)

confluence-content

 

(tick)

render

render

Render the imported content

boolean

true

(error)

output

output

Output the imported content (Switch this off when you are just importing logic)

boolean

true

(error)

flag

Flag

A list of flags, one of which must be defined for the content to be displayed

string

 

(error)

notflag

Not Flag

A list of flags which must not be defined for the content to be displayed

string

 

(error)

 

Panel Example

Import the content of a page from another space to show in your theme skin. ds=spacekey, More Information=page name

<ac:macro ac:name="import">
  <ac:parameter ac:name="import">ds:More information</ac:parameter>
</ac:macro>
{import:ds:More information}

Result

By adding the 'import' macro to the 'content' panel you can show the content of any page at the bottom of all your pages.

Page Example

On any page use the macro browser to insert the 'import' macro and you will get a popup, with fields to enter the space key and name of the page. If you start typing the page name a dropdown of pages will show.

Result

Alternate Sources

One of the most powerful features of the import macro is that it is not restricted to importing content from pages - it is also capable of sourcing content from space & global templates, editable-text objects, and layout resources. This is achieved through a series of checks and fall-backs, if data is not found matching the 'page name' in the first location, then the next is checked until all options are exhausted and a not found error is displayed.

The series of checks is as follows:

  1. A space level editable text object (only editable by space admins)
  2. A Global level editable text object (only editable by site admins)
  3. A page in the current space (normal page permissions apply)
  4. A space level template
  5. A global level template
  6. A resource on the current skin (or one of its parents) with the .xml extension (rendered as Storage Format)
  7. A resource on the current skin (or one of its parents) with the .xhtml extension (rendered as Storage Format)
  8. A resource on the current skin (or one of its parents) with no extension (output as raw html)
  9. A resource on the current skin (or one of its parents) with the .html extension (output as raw html)
  10. A resource on the current skin (or one of its parents) with the .wiki extension (rendered as wiki markup)

By combining the capabilities of the skin resources and either pages in the space or editable text objects it is possible to create a skin that is customisable by space admins or users without them needing to edit the skin itself.