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

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

eZ debug

Timing: Jan 31 2025 08:11:59
Script start
Timing: Jan 31 2025 08:11:59
Module start 'layout'
Timing: Jan 31 2025 08:11:59
Module start 'content'
Timing: Jan 31 2025 08:11:59
Module end 'content'
Timing: Jan 31 2025 08:11:59
Script end

Main resources:

Total runtime0.0185 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 588.1328151.2109
Module start 'layout' 0.00780.0035 739.343836.6484
Module start 'content' 0.01130.0056 775.992294.2656
Module end 'content' 0.01690.0015 870.257833.9922
Script end 0.0184  904.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002513.2787140.0002
Check MTime0.00116.0724140.0001
Mysql Total
Database connection0.00094.863610.0009
Mysqli_queries0.005228.363530.0017
Looping result0.00000.086410.0000
Template Total0.00116.010.0011
Template load0.00084.446910.0008
Template processing0.00031.499110.0003
Override
Cache load0.00063.067810.0006
General
dbfile0.00126.538180.0002
String conversion0.00000.052940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs