Fetch Children

Author Message

Softriva .com

Monday 19 February 2007 6:39:44 am

Hello,

I have the following content strcuture

News (N65)
--2005
----News1
----News22
--2006
----News3
----News11
----News14
----News26
--2007
----News12
----News10

I only can know the news folder node id which 65 and of course the year. How can I fetch the children?

I tried this but not sure if it's ok

{def latest_news=fetch( 'content', list, hash( 'parent_node_id', 65,
				'sort_by', array( 'published', false() ),
				 'limit',3,
                                 'attribute_filter', array( array( 'folder/name','=',$CurrentYear))

Nabil Alimi

Monday 19 February 2007 8:54:20 am

Hi,

Which content do you want to retrieve ? How would you like to sort it ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Softriva .com

Monday 19 February 2007 9:46:09 am

oooooops,

sorry, I want to fetch the news1, news22, news14, etc.

Damarev .

Monday 19 February 2007 6:45:29 pm

This could be a simple solution:

{def $current_folder=fetch( 'content', list, hash( 'parent_node_id', 65,
'limit',1,
'attribute_filter', array( array( 'folder/name','=',$CurrentYear))
}

{def $last_folder_id=$current_folder[0].node_id}

{def $latest_news=fetch( 'content', list, hash( 'parent_node_id', $last_folder_id,
'sort_by', array( 'published', false() ),
}

I know this is not the perfect approach, but it works.

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 19 2025 06:12:05
Script start
Timing: Jan 19 2025 06:12:05
Module start 'layout'
Timing: Jan 19 2025 06:12:05
Module start 'content'
Timing: Jan 19 2025 06:12:06
Module end 'content'
Timing: Jan 19 2025 06:12:06
Script end

Main resources:

Total runtime0.8811 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0040 589.0313152.6094
Module start 'layout' 0.00400.0033 741.640639.4297
Module start 'content' 0.00720.8721 781.0703577.5469
Module end 'content' 0.87940.0016 1,358.617212.1953
Script end 0.8810  1,370.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3390160.0002
Check MTime0.00120.1356160.0001
Mysql Total
Database connection0.00050.061410.0005
Mysqli_queries0.827393.8960620.0133
Looping result0.00060.0677600.0000
Template Total0.849096.420.4245
Template load0.00200.228420.0010
Template processing0.846996.126020.4235
Template load and register function0.00020.021710.0002
states
state_id_array0.00120.136110.0012
state_identifier_array0.00190.211620.0009
Override
Cache load0.00170.1901380.0000
Sytem overhead
Fetch class attribute can translate value0.00070.077730.0002
Fetch class attribute name0.00090.100950.0002
XML
Image XML parsing0.00090.100330.0003
class_abstraction
Instantiating content class attribute0.00000.001050.0000
General
dbfile0.00090.1036160.0001
String conversion0.00000.001040.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs