Shared Components

Search
Feedback

A Shared Component in Structr is a unique branch of page elements to reuse those elements on different pages.

Most pages have some identical sections like a header, a footer or a navigation menu. To avoid redundancy, they can be turned into Shared Components which are not part of and thus directly linked to a page but rather stored in a special area connected by a special relationship into multiple pages

When rendering a page, the rendering engine traverses down the page tree. When it hits a node connected to a Shared Component, its elements are rendered before continuing with the elements of the individual page.

How to create a Shared Component

Any element/element tree in the Pages Tree View can be used as a Shared Component by dragging it from the pages tree view into the “Shared Components” slideout on the right.

The element itself is removed from the page and a reference to the newly created Shared Component is inserted into the page at the position the element had before.

Now the Shared Component can be inserted into any page by drag’n’drop. When starting to drag the element, make sure to hold the mouse button down on the element itself and not the icon (see also http://stackoverflow.com/questions/40568417/structr-drag-n-drop-shared-component-fails).

Graph-Browser

About this article
Last change 2016-11-16
Topics Structr 2.0