For the complete documentation index, see llms.txt. This page is also available as Markdown.

Module Templates

A template is the object used to represent an element, stencil (element group) or static template; used for Data Widgets. All data widgets must have templates so that Xibo knows how to visualise the data returned by the Module.

Type
Description

element

Rendering for a single property on a data item

element-group

A preconfigured group of elements which together form a Stencil shown in the Layout Editor toolbox for the data widget

static

A static template, optionally with properties to customise appearance and behaviours.

They are defined using XML files, in the same way as modules. The xml definition describes the options available: https://account.xibosignage.com/docs/developer/widgets/xml-definitions#content-2-template

Type
Location

Core template XML

/modules/templates

Custom template XML

/custom/modules/templates

Starting in CMS v4.1 it is possible to create module templates inside the CMS using the Developer -> Module Templates menu.

RSS - a worked example

Xibo’s RSS module is a good example of a data widget. There is a rss-ticker.xml file which contains the properties found on the configure tab and a widget provider to fetch data from the configured URL. It declares it’s dataType as “article”, which has the following properties:

public function getDefinition(): DataType
{
    $dataType = new DataType();
    $dataType->id = self::$NAME;
    $dataType->name = __('Article');
    $dataType
        ->addField('title', __('Title'), 'text')
        ->addField('summary', __('Summary'), 'text')
        ->addField('content', __('Content'), 'text')
        ->addField('author', __('Author'), 'text')
        ->addField('permalink', __('Permalink'), 'text')
        ->addField('link', __('Link'), 'text')
        ->addField('date', __('Created Date'), 'datetime')
        ->addField('publishedDate', __('Published Date'), 'datetime')
        ->addField('image', __('Image'), 'text');
    return $dataType;
}

Xibo provides elements for each of these data fields in the article-elements.xml file, and some static templates in the article-static.xml file.

We can easily create a new static template which renders out article data types:

Included here is a very basic template which will render out the title field of each data item. xiboTextRender will split that into pages if an effect has been selected (via the effects selector output as a property).

Last updated

Was this helpful?