# XT-K2 Link Item User's Guide

# Overview and Quick Setup

Once the XT-K2 Link Item plugin is installed and enabled, a new K2 Link Item management area is shown under the K2 article editor:

K2 Link Item management area

Clicking on the Select Items button, a new dialog to select items is shown to select associated articles:

K2 Link Item management area

After articles are associated with the main item, relationships can be managed in the K2 Link Item management area:

K2 Link Item associated articles

In the area below the associated items, several parameters allow to control how the relations are shown in the front-end site:

K2 Link Item parameters

# Item View and Category View Templating

The associated items views generated in the front-end site can be overriden.

By default, these files are used to generate the views:

  • plugins/k2/xtlinkitem/tmpl/category.php
  • plugins/k2/xtlinkitem/tmpl/item.php

To override these views, new layouts can be created at template level. For example, creating these new files based on the default layouts:

  • templates/YOUR_TEMPLATE/html/plg_k2_xtlinkitem/category.php
  • templates/YOUR_TEMPLATE/html/plg_k2_xtlinkitem/item.php

Reference: Understanding_Output_Overrides (opens new window)

# How to extend Item View and Category View templates for K2 Linked Articles

Templates have a main loop where the linked articles are visited. In each iteration, a linked articled is displayed. By default, the linked article has the attributes from #__k2_items to be shown.

In certain cases, there is a requirement to show additional information associated with the linked article. For instance, Tags from the linked article.

To extend the Item View Template to show linked article tags, the item view override must be created in templates/YOUR_TEMPLATE/html/plg_k2_xtlinkitem/item.php (around line 17) and this code to render tags must be added in the loop:

In this way, now it is possible to show any value from the full K2 model, in the same way than it is implemented in the original K2 view (item.php). For example, the set of tags:

Last Updated: 3/20/2024, 3:32:54 PM