keyword

Summary

Fetches nodes that use keywords starting with a given sequence.

Usage

fetch( 'content',  'keyword',  hash( 'alphabet', alphabet,
                                   [ 'classid',  classid, ]
                                   [ 'limit',    limit,   ]
                                   [ 'offset',   offset,  ] ) )

Parameters

NameTypeDescriptionRequired
alphabet string The sequence that should be matched. Yes.
classid array Filtering: the ID number of the class or an array of the ID numbers. No.
offset integer The offset to start at. No.
limit integer The number of elements that should be returned. No.

Returns

An array of hashes (see below) or FALSE.

Description

This function fetches nodes that encapsulate objects which make use of certain keywords. The keyword must be prodived using the "alphabet" parameter. This parameter can be a letter, a part of a word or an entire word - the function will look for keywords that start with the specified sequence. By default, the function will fetch nodes that encapsulate objects of all types. However, it is possible to only fetch objects of a certain type, this can be achieved by using the optional "classid" parameter. The "offset" and "limit" parameters can be used to limit the result. The function returns an array of hashes. Each hash consists of the following elements:

Key

Type

Description

keyword

string

The keyword that was matched.

link_object

object

The node (as a ezcontentobjecttreenode object) that encapsulates an object which uses the matched keyword.

If no match is found, the function will return FALSE.

Examples

Example 1

{def $list=fetch( 'content', 'keyword',
                  hash( alphabet, 'computer',
                        classid,   3 ) )}
 
{foreach $list as $element}
    {$element.link_object.name|wash} ({$element.keyword|wash}) <br />
{/foreach}

Outputs the names of nodes that encapsulate objects which make use of keywords starting with the string "computer". In addition, the matched keywords are also printed.

Example 2

 

{def $list=fetch( 'content', 'keyword',
                  hash( alphabet, 'computer',
                        classid, array( 1, 3 ) ) )}


Only nodes that encapsulate objects of the specified two classes will be fetched.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.