Forums / Setup & design / hash, classID or className?

hash, classID or className?

Author Message

nigel dodd

Friday 05 November 2004 10:08:33 am

Using classIDs, i.e. numbers, in the hash function for Fetch evidently works. However the documentation sometimes uses classNames, eg:

{* Loop through all sub-folders within the "Links" folder. *}
{section loop=fetch( content,
                     list,
                     hash( parent_node_id,     __NODE_ID_OF_LINKS__,
                           class_filter_type,  include,
                           class_filter_array, array( 'folder' ),
                           sort_by,            $node.sort_array ) ) }

which uses the className 'folder' instead of numeral 1 classID. Can we use our homegrown classes here by name?

There seems scope for confusion here since using 'article' returns nodes with classes only of type article whereas using 'Article' seems to return ALL nodes regardless of class. Likewise, using my own homegrown classes by name seems to return all nodes regardless of class.

I cannot find the definition of this function in the php code to see how it works. Could someone more knowledgeable please comment.

nigeldodd AT blueyonder.co.uk

Hans Melis

Saturday 06 November 2004 1:14:55 am

Hi Nigel,

The content/list fetch function is documented here:
http://ez.no/ez_publish/documentation/reference/data_fetching/content/list

There's a heading "Class filtering" (they forgot to put it in bold though, but it's the paragraph after Filtering). There you'll see that you can use numerical IDs or class <b>identifiers</b>. So there's the reason for the difference between 'article' and 'Article'. An identifier is a stripped version of a name. The identifier is reliable for fetching, the name isn't.

'Article' is not an identifier, so the class filtering fails and returns everything. 'article' is the correct identifier of the Article class, so the filtering works.

You can see the identifiers in the class list in the admin interface. And yes, you can use your custom made classes in the same way. There's no difference for eZ publish.

hth

Hans
http://blog.hansmelis.be

nigel dodd

Saturday 06 November 2004 11:57:13 am

Thanks Hans,

I failed to follow the documentation down to the leaves of the tree.

It is still slightly counter-intuitive that the function returns ALL nodes if you ask for those belonging to a non-existant class. I would expect it to return no nodes at all.

Grateful for your help.

Nigel

Paul Borgermans

Sunday 07 November 2004 7:10:46 am

Nigel,

Please file a bug report on this (returning all nodes with invalid class id's).

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans