Start page

Mykola Zharkikh (Kyiv)

Personal site

?

Aggregators

Smeretags-aggregators are similar to cycle operators in program languages: they get the HTML code with smeretags and calculate it (do substitution of smeretags) for a list of nodes. The resulting HTML code is the sum of HTML codes calculated for the individual nodes.

Most aggregators are used to generate navigators – various lists of links to the nodes, but they can be used to form various reports, catalogs and other data for which you must combine information from multiple nodes.

Although the basic set of Smereka modules contains a lot of different aggregators, it is impossible to foresee all cases of their applications, and Smereka programmer often found the need to write their own aggregators.

SmerAggregator

Module: aggregators/aggregator.php

Options: SmerekaValue Node LimitToClass HideMode

Purpose: performs HTML code calculations transferred in the parameter SmerekaValue for child nodes of the base node. If the parameter Node specified, it defines the base node id and if it is not given, contextual node suggested to be base node. If the parameter LimitToClass defined as a class id, than only nodes of the given class are processed. If the parameter HideMode = 1, aggregator will skip the nodes, which attribute Hidden = True.

Example call. Displays a list of articles subjected to certain node:

<Smereka1 Module="aggregators/aggregator.php" Func="SmerAggregator"
Node="1…" HideMode="1">
<p class="BT">
 <Smereka Module="aggregators/navigators.php"
Func="NavigatorItem" />
</p>
</Smereka1>

OneLineNavigator

Module: aggregators/navigators.php

Options: Same as for SmerAggregator

Purpose: display a list of links for the child nodes as a single line.

Example call. Displays a list of articles subjected to certain node:

 <Smereka Module="aggregators/navigators.php"
Func="OneLineNavigator" Node="1…" />

This method is best used when the names are short and the entire list can be displayed as one line.

TrackBar

Module: aggregators/navigators.php

Options: IncludeRoot IncludeLeaf Separator MaxDocTitle

Purpose: create "breadcrumbs" – the way in the document tree from the root to the current node.

IncludeRoot = 0 – does not include the root node;

IncludeRoot = 1 – include a root node, but without link;

IncludeRoot = 2 – include the root node as a link (default);

IncludeLeaf = 0 – does not include leaf node;

IncludeLeaf = 1 – include leaf node, but without link (default);

IncludeLeaf = 2 – include leaf node as a link;

Separator – path separator (by default ' / ');

MaxDocTitle – the number of characters to include from DocTitle; by exceeding the title cropped at this position and symbol … added ; the default is not given – a reduction is not performed.

Example call: <Smereka Module="aggregators/navigators.php" Func="TrackBar" />

Example result: You can see on this page below the title.

TableAggregator

Module: aggregators/tablemaker.php

Options: Same as for SmerAggregator, + NumColumns Order Numbering NumberStr

Purpose: create a table with aggregate data.

NumColumns – number of columns for the table (default 2);

Order = 'column' – fill container table by columns:

1…	10…
2…	11…

Order = 'row' – fill container table by rows (default):

1… 2…
5… 6…

Numbering – initial values from which to start numbering items in the table, if not set – do not enumerate at all.

NumberStr – bar code in the template (SmerekaValue), which should be replaced with number. If do not set – do not enumerate at all.

Example call:

<table class="BTNoIndent" cellpadding="4">
<Smereka1 Module="aggregators/tablemaker.php"
Func="TableAggregator" Node="1…" HideMode="1"
NumColumns="2" Order="column" Numbering="1"
NumberStr="As16Xz86">
<tr>
<td>
 As16Xz86. <Smereka Module="aggregators/navigators.php"
Func="NavigatorItem" />
</td>
</tr>
</Smereka1>
</table>

Gallery

Module: aggregators/tablemaker.php

Options: Same as for TableAggregator

Purpose: to form a gallery of images as a table with links.

Example call: <Smereka Module="aggregators/tablemaker.php" Func="Gallery" />

Example result: You can see here.

TableOfContent

Module: aggregator/articlenavigators.php

Options: Same as for SmerAggregator, + WithAuthors

Purpose: display hierarchical list of links for the child nodes all subordinate levels (to form table of contents for a hierarchical publication).

WithAuthors – if this parameter is 1, then for each node, which has an attribute Authors, it will appear before the title.

Example call.

 <Smereka Module="aggregators/articlenavigators.php"
Func="TableOfContent" />