fetching items with various locations

Author Message

Marko Žmak

Wednesday 28 July 2004 7:27:44 am

I have two folders: "News" and "Science". I would like to display a list of those and only those articles that have this two folders for their location.
Is there any posibility to make a criteria for the fetch function that would fetch only theese folders?

Please help.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Nicolas Heiringhoff

Thursday 29 July 2004 2:40:06 am

Hello,

You could use this code to display the title, intro and body for all the articles in your "News" folder


{* Fetch everything that is under node #296 (children, grand-children, etc.) *}
{let nodes=fetch( 'content', 'tree', hash( 'parent_node_id', 296 ) ) }

{* Loop through the nodes and display their names. *}
{section loop=$nodes}



<br />
    <a href={concat("/content/view/full/",$:item.node_id)|ezurl}>{$:item.data_map.title.data_text}</a>
    
    <br />
    {$:item.data_map.intro.data_text}
    
    <br />
    
    {$:item.data_map.body.data_text}

    <br />    

{/section}



{/let}

simply replace the node id 296 with the node id of your "News"-folder.

For displaying all the articles in your "Science"-folder, simply use the code above another time, with the node id of the "Science"-folder.

this should work.

Nico

http://www.heiringhoff.de

Silke Fox

Thursday 29 July 2004 5:12:16 am

You can also use an array of node ids for fetch functions.

{let nodes=fetch( 'content', 'tree', hash( 'parent_node_id', array( <node1>, <node2> ) ) ) }

Marko Žmak

Thursday 29 July 2004 10:05:02 am

Nicolas, I think that you didn't understand my problem but Silke did.
Thanks Silke, I'll give it a try. Does the fetch function use "AND" or "OR" operator on nodes in the nodes array in your example. For my problem, I need "AND"...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Silke Fox

Thursday 29 July 2004 12:13:29 pm

Marko,
yes, it is "AND".
The result is an array of your "News" and "Science" objects.
That way you can also sort all objects from these two nodes in one list.

Silke

Marko Žmak

Thursday 29 July 2004 2:21:20 pm

Thanks a lot.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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

Main resources:

Total runtime0.0139 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.0041 588.2500151.2266
Module start 'layout' 0.00410.0030 739.476636.6797
Module start 'content' 0.00710.0054 776.156394.2813
Module end 'content' 0.01250.0014 870.437537.9922
Script end 0.0139  908.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002316.5194140.0002
Check MTime0.00117.6379140.0001
Mysql Total
Database connection0.00064.642010.0006
Mysqli_queries0.002417.122330.0008
Looping result0.00000.142210.0000
Template Total0.00107.510.0010
Template load0.00085.740010.0008
Template processing0.00021.760910.0002
Override
Cache load0.00053.699910.0005
General
dbfile0.002114.962380.0003
String conversion0.00000.065140.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