limb2:en:template_system:tags:fetching_tags:datasource_tag
Содержание
Datasource Tag and Component
Tag datasource_tag
<DATASOURCE target='target1[,target2,target3]' [navigator='navigator']> <core:PARAMETER name='datasource_path' value='/path/to/datasource'> [ <core:PARAMETER name='param1' value='value1'> <core:PARAMETER name='param2' value='value2'> ] </DATASOURCE>
Purpose
Generic tag for fetching any kind of data. Generates a dataset and transfers it to the target components at runtime. If navigator(pager) attribute specified it takes also into account pager settings: limit, offset.
Note: Limb File Path Resolving Technique is applied to 'datasource_path' attribute of the <core:PARAMETER> tag
Scope
Anywhere in a WACT template
Attributes
- target – runtime component that accepts a dataset. You can set several targets separated by commas. Target components have to support register_dataset() method.
- navigator - runtime paging component.
Other parameters can be set by inner <core:PARAMETER> tags. See runtime components method for more details.
Content
Several <core:PARAMETER> tags
Example
<DATASOURCE target='last_news'> <core:PARAMETER name='loader_class_name' value='news_object'> <core:PARAMETER name='datasource_path' value='fetch_datasource'> <core:PARAMETER name='fetch_method' value='fetch_accessible'> <core:PARAMETER name='limit' value='10'> <core:PARAMETER name='order' value='news_date=DESC; name=ASC'> </DATASOURCE>
Component datasource_component
Runtime component for the <DATASOURCE> tag. Uses datasource attribute and parameters array to perform a fetching operation.
Methods
- get_dataset() – returns a fetched dataset
- get_total_count() - returns total number of records that satisfy conditions (limit parameter is omitted).
- set_parameter($name, $value) – a method for setting a parameter for the fetching operation.
- _set_limit_parameters($limit_string) – processes limit parameter.
- _set_order_parameters($order_string) - processes limit parameter. You can set several sorting rules by separating them with ‘;’ (see example).
- _get_datasource() – creates an object that used for the fetching operation. You can set datasource class name with <core:PARAMETER name='datasource_path' value='some_datasource'> tag. Datasource classes are stored in /core/datasource/ directory.
- _get_params_array() – processes parameters array that will be used in the fetching operation.
limb2/en/template_system/tags/fetching_tags/datasource_tag.txt · Последнее изменение: 2010/11/10 10:02 — 127.0.0.1

Обсуждение