How To... Inherit Content From Other Pages

Displaying the content of manual snippets across other pages

Editable components from one page can be displayed in a non-editable component on other pages. This is useful if you want consistent content displayed across your site, but only editable in one location.

To do this, create a component on, for example, the layout used for the home page, and a component on a sub-page layout of this page and give both components the same location value.

Ensure that only the component on the home page is editable, and the component in different layouts is non-editable.

Here's how...

1. Write the 'parent' component

On home page, add this component that includes a fortypes attribute of 'root':

  1. <pepperio:component name="footer" snippet="footer_manual_links" location="4000" fortypes="root" />

2. Write the 'child' component

On a subpage layout, add a component with fortypes set to 'theme, and an Inherit attribute with a value of 'yes':

  1. <pepperio:component name="footer" snippet="footer_manual_links" noteditable="yes" location="4000" fortypes="theme" inherit="yes" />

The result is that both components then reference the same snippet (e.g. 'footer_manual_links) and utilise the same data (because they both reference the same location in the database (in this example, location 4000, but that could be any number between 2048 and 32767).

The root component is still editable and the fortypes attribute defines whether the component is only used on the root, or elsewhere.

Note: if this method suddenly stops working while you are testing it, change to a different location number each time.


See Also:

Video Guides

How To...

Tag Definitions