Difference between revisions of "Paging Plugin"

From MSX - Wiki
Jump to navigation Jump to search
Line 1: Line 1:
This is a special interaction plugin that allows you to integrate paging into templated content items (i.e. a [[Content Root Object]] that uses the <code>template</code> and <code>items</code> properties). The plugin can be used with version '''0.1.82''' or higher.
+
This is a special interaction plugin that allows you to integrate paging into templated content items (i.e. a [[Content Root Object]] that uses the <code>template</code> and <code>items</code> properties). In order to use this plugin, a corresponding content service must be implemented that processes the requested items (i.e. by evaluating the <code>offset</code> and <code>limit</code> parameters). The plugin can be used with version '''0.1.82''' or higher.
  
 
== Usage ==
 
== Usage ==
The plugin must be loaded with a content URL. Optionally, the limit can be indicated (by default, it is set to 20). Please see following action syntax examples.
+
The plugin must be loaded with a content service URL that is able to evaluate the <code>offset</code> and <code>limit</code> parameters. Optionally, the requested limit can be indicated (by default, it is set to 20). Please see following action syntax examples.
  
 
* <code>content:request:interaction:{URL}@http://msx.benzac.de/interaction/paging.html</code>
 
* <code>content:request:interaction:{URL}@http://msx.benzac.de/interaction/paging.html</code>
 
* <code>content:request:interaction:{URL}|{LIMIT}@http://msx.benzac.de/interaction/paging.html</code>
 
* <code>content:request:interaction:{URL}|{LIMIT}@http://msx.benzac.de/interaction/paging.html</code>
  
The content URL should contain the keywords <code>{OFFSET}</code> and <code>{LIMIT}</code>, which are replaced with the corresponding values. Please see following action syntax examples.
+
The content service URL should contain the keywords <code>{OFFSET}</code> and <code>{LIMIT}</code>, which are replaced with the corresponding <code>offset</code> and <code>limit</code> values. Please see following action syntax examples.
  
 
* <code>content:request:interaction:http://link.to.content?offset={OFFSET}&limit={LIMIT}@http://msx.benzac.de/interaction/paging.html</code>
 
* <code>content:request:interaction:http://link.to.content?offset={OFFSET}&limit={LIMIT}@http://msx.benzac.de/interaction/paging.html</code>
* <code>content:request:interaction:http://link.to.content?offset={OFFSET}&limit={LIMIT}|20@http://msx.benzac.de/interaction/paging.html</code>
+
* <code>content:request:interaction:http://link.to.content?offset={OFFSET}&limit={LIMIT}|40@http://msx.benzac.de/interaction/paging.html</code>
 +
 
 +
== Syntax ==
 +
{| class="wikitable sortable"
 +
|+ Parameter syntax of content service URL for paging plugin
 +
|-
 +
! Parameter !! Type !! Default Value !! Mandatory !! class="unsortable" | Description
 +
|-
 +
| <code>offset</code> || <code>number</code> || <code>0</code> || No ||
 +
The offset that specifies from which offset the items should started.
 +
|-
 +
| <code>limit</code> || <code>number</code> || <code>20</code> || No ||
 +
The limit that specifies how many items should be returned.
 +
 
 +
'''Note: If the content service returns less or more items then indicated, no additional items are requested.'''
 +
|}

Revision as of 10:46, 9 February 2024

This is a special interaction plugin that allows you to integrate paging into templated content items (i.e. a Content Root Object that uses the template and items properties). In order to use this plugin, a corresponding content service must be implemented that processes the requested items (i.e. by evaluating the offset and limit parameters). The plugin can be used with version 0.1.82 or higher.

Usage[edit]

The plugin must be loaded with a content service URL that is able to evaluate the offset and limit parameters. Optionally, the requested limit can be indicated (by default, it is set to 20). Please see following action syntax examples.

The content service URL should contain the keywords {OFFSET} and {LIMIT}, which are replaced with the corresponding offset and limit values. Please see following action syntax examples.

Syntax[edit]

Parameter syntax of content service URL for paging plugin
Parameter Type Default Value Mandatory Description
offset number 0 No

The offset that specifies from which offset the items should started.

limit number 20 No

The limit that specifies how many items should be returned.

Note: If the content service returns less or more items then indicated, no additional items are requested.