<logic:include>
AJAX
Data
Forms
Layout
Logic
ATTRIBUTES
EXAMPLES
Navigation
Personalisation
Standard
Templates
Regions
Third Party

<logic:include />

Include the content of a page.

Often used to reduce duplicate content, where the same content needs to be shown in multiple places throughout a site.

For organisation, developers often create a new hidden page /includes/, and child pages are included in various locations through pages or in a website design.

As an example, if you needed a newsletter sign-up form shown in multiple places throughout a website, create the form on a page, and then simply include that page where needed with <logic:include page="/includes/newsletter/" />

Attributes

page
string
The page_id of the page to be included.

Examples

Include the Contents of a Page

The contents of /includes/newsletter/ will be included in place of this tag.

HTML:

<logic:include page="/includes/newsletter/" />

Query String Injection

You can pass query string parameters to the included page.

HTML:

<logic:include page="/includes/product-banner/?product_id=4" /> From within /includes/product-banner/ the value of $_GET['product'] will be set to 4.

Repeat Child Pages as Rotator Slides

Demonstrates the use of a data repeater to populate rotator slides with the content of pages.

HTML:

<div class="section-homeBanner"> <layout:rotator id="featured_rotator" startatrandom="false" movenextid="featured_rotator_next" movepreviousid="featured_rotator_previous"> <ul> <data:repeater datasource="\Components\Website\Pages::getChildren('/includes/slider/')" as="slider"> <li> <logic:include page="[? $slider['page_id'] ?]" /> </li> </data:repeater> </ul> </layout:rotator> <div class="rotator_navigation"> <span class="leftArrow"><a href="#" id="featured_rotator_previous"><standard:icon library="fontawesome" iconstyle="solid" iconname="chevron-left" size="4" style="width: 50px; height: 50px;" /></a></span> <span class="rightArrow"><a href="#" id="featured_rotator_next"><standard:icon library="fontawesome" iconstyle="solid" iconname="chevron-right" size="4" style="width: 50px; height: 50px;" /></a></span> </div> </div>

Repeat Child Pages as a Set of Tabs

Demonstrates the use of a data repeater to populate tabs with the content of pages.

HTML:

<layout:tablist> <data:repeater as="page" datasource="\Components\Website\Pages::getChildren('/includes/tabs/')"> <layout:tablistitem id="tab_[? $page['_index'] ?]" title="[? $page['page_title'] ?]"> <logic:include page="[? $page['page_id'] ?]" /> </layout:tablistitem> </data:repeater> </layout:tablist>