ez.no / exponential / documentation / reference / template functions / miscellaneous / fetch_alias
fetch_alias( alias_name [,hash( param_name1, param_value1
[, param_name2, param_value2] ) ] )
| Name | Type | Description | Required |
|---|---|---|---|
| alias_name | string | Name of the fetch alias | yes |
| param_name1 | string | Name of parameter 1 | no |
| param_value1 | string | Value of parameter 1 | no |
| param_name2 | string | Value of parameter 2 | no |
| param_value2 | string | Value of parameter 2 | no |
Result of fetch
Fetch alias is an ini based version of the fetch function (
Data fetching) . The fetch is defined in settings/fetchalias.ini
General structure:
[fetch_alias_name] Module=module_name FunctionName=function_name Parameter[parameter_name1]=fetch_alias_name1 Parameter[parameter_name2]=fetch_alias_name2 ... Constant[parameter_name3]=<any value> Constant[parameter_name4]=<any value>
Each fetch alias must have a unique name.
Ini parameters:
Fetch object :
Ini setting
[object] Module=content FunctionName=object Parameter[object_id]=id
Template code
{let object=fetch_alias( object, hash( id, 1 ) )}
Fetch comments from article:
Ini setting
[comments] Module=content FunctionName=list Constant[sort_by]=published;0 Parameter[parent_node_id]=parent_node_id Constant[class_filter_type]=include Constant[class_filter_array]=comment
Template code
{let comments=fetch_alias( comments, hash( parent_node_id, 42 ) ) }
Fetch news list:
Ini setting
[news_list] Module=content FunctionName=tree Constant[sort_by]=published;0 Constant[class_id]=2 Constant[parent_node_id]=2 Constant[class_filter_type]=include Constant[limit]=10 Constant[class_filter_array]=2
Template code
{section loop=news_list=fetch_alias( news_list )} {node_view_gui node=$:item} {/section}
Will display 10 last news articles in full.
log in or create a user account to comment.
Comments