Forums / Setup & design / Getting child items of a folder

Getting child items of a folder

Author Message

Jan Petter Dale

Thursday 05 January 2006 8:38:13 am

Hi. I'm pretty new to php and ezpublish system, so bare with me with my very rookie
questions here :)

This is what i've done:

Made a class that allows the user to input user data, to be stored in a folder
Made a section connected to that folder that contains the items that the users post,
so that I can easily create override templates with code that changes how the data
is outputted on a browser.

I've succesfully made items after creating the class, and successfully listed the items
with this code:

<div class="pagetitle">

   Member information

</div>

 

<div class="imageleft">

   {* Display a picture of the member. *}

   {attribute_view_gui attribute=$node.object.data_map.picture}

</div>

 

{* Display the attribute names and their values. *}

<table class="member_info" cellspacing="4" cellpadding="3">

   <tr>

       <td><b>{$node.object.data_map.realname.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.realname}</td>

   </tr>

   <tr>

       <td><b>{$node.object.data_map.nickname.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.nickname}</td>

   </tr>

   <tr>

       <td><b>{$node.object.data_map.birthdate.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.birthdate}</td>

   </tr>

   <tr>

       <td><b>{$node.object.data_map.gender.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.gender}</td>

   </tr>

   <tr>

       <td><b>{$node.object.data_map.phone.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.phone}</td>

   </tr>

   <tr>

       <td><b>{$node.object.data_map.email.contentclass_attribute.name}:</b></td>

       <td>{attribute_view_gui attribute=$node.object.data_map.email}</td>

   </tr>

</table>

Which is pretty simple. But before that code is initiated, a list of each item in that folder is presented to me on the screen.
It is very similar to making a folder on admin screen, then adding an article.

You can see an example here: http://www.trav24.no/index.php/portal/travtrenere/soerlandets_travpark

At that example, it lists the items in that folder. Instead I want it to list the content of each item, inside that very folder. So instead of clicking on i.e. 'Arild BerĂ¥s', it will just list the
preformatted item on the first page there, including all the other ones that might lay
in the folder.

Could anyone help me make a code that loops through the items in each folder,
uses the code above to fetch the data and to format it as I want it to be?

Thanks in advance.

Siw Helen Thorslund

Thursday 05 January 2006 10:15:28 am

You can make an override of the list view of your class for the members.
Then make this display whatever content you want in list view.

An example: http://ags.no/ags/om_ags/kontakt_oss

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Jan Petter Dale

Thursday 05 January 2006 11:41:56 am

Thank you for your reply.

I guess the real question in all this is how to loop through the child objects of a node/folder.

I.e.

/ezp/content/info01
/ezp/content/info02
/ezp/content/info03
/ezp/content/info04
/ezp/content/info05

If i then create a section that is connected to that content folder, what code makes me
able to loop through the chile objects of that folder(info01, info02, etc).

From my limited knowledge about programming, I can understand that this code:

{$node.object.data_map.realname.contentclass_attribute.name}:

it takes the current node, fetches the contentclass stored variables and makes you able to print it to the screen. The problem is that when I input this code to an override to the
specified folder(/ezp/content/), it will try to fetch the data from the current folder node, and
not the info01,info02,info03...etc which is the real nodes,items or objects(if that's what you call it) that stored the information i've put in.

Arran Price

Sunday 08 January 2006 4:13:33 pm

Hi,
Im a little confused as to what you are after.
Ive had a look at the link you provided, are you wanting more than just the name and the default icon on that page prior to going into the item itself?
If so you just need to override the line view of the item.

What currently is happening is that the folder by default will list all of its contents using the line view of each of those items. When you click into each item you get the full view of it. Each view can be overriden specifically.
If thats what you are after there is no need to loop through anything as the folder by default will "loop" through to disaply the line view of each element if contains.

If you are looking to do something else entirely which involves getting a number of content objects from somewhere then processing them, you need to do a "fetch" of which there is an examples page in the documentation.

hope thats of some help

Arran

eZ debug

Timing: Jan 18 2025 16:11:45
Script start
Timing: Jan 18 2025 16:11:45
Module start 'content'
Timing: Jan 18 2025 16:11:45
Module end 'content'
Timing: Jan 18 2025 16:11:45
Script end

Main resources:

Total runtime0.1298 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 587.7266180.8359
Module start 'content' 0.00550.0049 768.562597.9922
Module end 'content' 0.01040.1193 866.5547533.3047
Script end 0.1297  1,399.8594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.4987200.0002
Check MTime0.00131.0225200.0001
Mysql Total
Database connection0.00090.716410.0009
Mysqli_queries0.089669.04741410.0006
Looping result0.00110.84061390.0000
Template Total0.119091.710.1190
Template load0.00070.544710.0007
Template processing0.118391.176310.1183
Override
Cache load0.00050.382310.0005
Sytem overhead
Fetch class attribute can translate value0.00080.651810.0008
XML
Image XML parsing0.00030.206510.0003
General
dbfile0.00322.4726200.0002
String conversion0.00000.003930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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