fetch_alias

Summary

Ini based fetch function

Usage

fetch_alias( alias_name [,hash( param_name1, param_value1
               [, param_name2, param_value2] ) ] )

Parameters

NameTypeDescriptionRequired
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

Returns

Result of fetch

Description

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:

  • Module - name of the module.
  • FunctionName - function name.
  • Parameter - the parameters specify variables which can be set in the templates. The parameter_name maps to the parameter name used in normal fetch functions. fetch_alias_name is the parameter name used in the templates.
  • Constant - Parameters in the regular fetch functions which is defined as constants.

Examples

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.

Comments

log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
    GUI
    Miscellaneous
       cache-block
       fetch_alias
       include
       ldelim
       literal
       rdelim
       run-once
    Program flow
    Variables
Data fetching
Modules
XML tags


Created

19/07/2004
12:11:31 pm
by Kåre Køhler Høvik

Last updated

19/07/2004
3:54:21 pm
by Ole Morten Halvorsen

Authors

Kåre Køhler Høvik
Ole Morten Halvorsen



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.