get objects for a specific class name

Author Message

Scott Foster

Saturday 25 December 2010 10:30:11 am

How can I get all the objects for a specific class based on the class identifier? I tried the following code for getting objects based on the class id -
// 72 being the ID for the standard_page class with 100 objects under it.
{let related_objects=fetch( 'content', 'related_objects', hash( 'object_id', 72 ) )}
{section loop=$related_objects var=related_object}
Name: {$related_object.item.name}<br />
{/section}
It returns nothing.
Any idea what I am doing wrong?

Peter Keung

Saturday 25 December 2010 10:27:24 pm

A few options:

Template code:
- content / list or content / tree fetch with class_filter_type "include" and class_filter_array with the class in question
- class / list fetch with class_filter with class in question, then access the undocumented .object_list attribute on the returned ezcontentclass object

PHP code:
- eZContentObject::fetchSameClassList( $contentClassID ) (http://pubsvn.ez.no/doxygen/4.4/html/classeZContentObject.html#ac330469c77b41c05170bd5cb2c770fb4)

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

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 18 2025 05:04:37
Script start
Timing: Jan 18 2025 05:04:37
Module start 'layout'
Timing: Jan 18 2025 05:04:37
Module start 'content'
Timing: Jan 18 2025 05:04:38
Module end 'content'
Timing: Jan 18 2025 05:04:38
Script end

Main resources:

Total runtime1.1702 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0156152.6250
Module start 'layout' 0.00570.0031 740.640639.4531
Module start 'content' 0.00881.1602 780.0938527.1250
Module end 'content' 1.16900.0011 1,307.21888.1563
Script end 1.1702  1,315.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3005160.0002
Check MTime0.00150.1269160.0001
Mysql Total
Database connection0.00120.099510.0012
Mysqli_queries1.122995.9561540.0208
Looping result0.00060.0522520.0000
Template Total1.140097.420.5700
Template load0.00240.201120.0012
Template processing1.137797.219320.5688
Template load and register function0.00020.015110.0002
states
state_id_array0.00120.103710.0012
state_identifier_array0.00140.119720.0007
Override
Cache load0.00190.1611190.0001
Sytem overhead
Fetch class attribute can translate value0.00110.098020.0006
Fetch class attribute name0.00160.140130.0005
XML
Image XML parsing0.00070.058320.0003
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.00080.0647170.0000
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs