Friday 07 November 2003 1:15:23 am
This really helped me a lot, so can this be included in the online documentation to help other users.
Fetch Function The fetch function is a very useful template function, but unfortunately it's (up to now) very poorly documented. An example of using it is shown in Template Language (3.x). But this page will try to explain the details. fetch( <module>, <function>, <parameters> ) It takes 3 arguments:
<module> (string)
<function> (string)
<parameters> (associative array) The function and its parameters are defined in [module]/function_definition.php. --------------------------------------------------------------------------------
Module: content
Functions: list, list_count, tree, tree_count, node Parameters:
parent_node_id [integer]
node_id [integer] (only for function 'node')
sort_by [array] default: false
first array field is the field to sort:
"class_identifier"
"class_name"
"depth"
"modified"
"name"
"path"
"priority"
"published"
"section"
second array field is the order:
"true()" -> ascending
"false()" -> descending
offset [integer] default: false
limit [integer] default: false
depth [integer] default: 1
class_id [integer] default: false unused?
class_filter_type [string] default: false
"include"
"exclude"
class_filter_array [array] default: false
list of class ids Examples: Fetching subnodes of parent node 5, but only of class ids 2 (e.g. categories): fetch( 'content', 'list', hash(parent_node_id, 5, class_filter_type, "include", class_filter_array, array(2)) Fetching node with node_id 23: fetch( 'content', 'node', hash(node_id, 23)) Fetching subnodes of parent node 10 and sorting ascending by name: fetch( 'content', 'list', hash(parent_node_id, 10, "sort_by", array("name", true())))
|