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

<logic:dependency> </...>

Defines a region to be toggled on or off depending on whether or not a component is installed. Usually only necessary for optional components.

Content

any
The content to show if the component is installed.

Attributes

components
array
Sets the components to which this block is dependent to

Examples

Display Comments

Determines whether the Comment component is enabled, and renders comments and ratings.

HTML:

<logic:dependency components="\Components\Website\Comments"> <h4>Total Rating: [? \Components\Website\Comments::getRatingForPage(\Components\Website\Pages::currentPageId()) ?]</h4> <data:repeater as="comment" datasource="\Components\Website\Comments::getAll()" datafilter="[? [['comment_url', '=', \Components\Website\Pages::currentPageId()]] ?]"> <p>[? $comment['contact_first_name'] ?] says: [? $comment['comment_text'] ?]</p> </data:repeater> </logic:dependency>