Show Children

Author Message

Alvin Andrews

Thursday 20 May 2010 1:15:19 am

Hi

I create my members myself. Under them I create more members (sub items).

How do I show my sub items when my user (who has users as sub items) is logged in.

e.g. If User1 is logged in:

User1
- User2
- User3

Thank You in advance

Paul Leclercq

Thursday 20 May 2010 2:50:39 am

If your users are objects, then you should easily be able to fetch these children by using a simple fetch in your template:

{def $my_user = fetch('user', 'current_user')}

http://ez.no/doc/ez_publish/technical_manual/4_x/reference/modules/user/fetch_functions/current_user

You should then be able to fetch the users bellow this one, by using the node_id of your user
maybe something like this:

{def $users_children = fetch('content', 'list', hash( 'parent_node_id', $my_user.node.id,

'class_filter_type', 'include',
'class_filter_array', array('user')
))}

Although I don't really recommend doing this on large areas of your site, or anysite which is accessible on the web, since this means you are going to have to check which user is using each template, and therefore de-activate the cache on that page or template, or area of the page, and will most likely result in really really bad page generation times.

If you really wish to do something like this, I highly recommend you fetch your users and children once, create a cookie with the information you need, and display this using some kind of javascript method. That way you will be able to re-activated the cache on those pages, and you will only need to check if your user is connected or not.

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 04:59:33
Script start
Timing: Jan 18 2025 04:59:33
Module start 'layout'
Timing: Jan 18 2025 04:59:33
Module start 'content'
Timing: Jan 18 2025 04:59:34
Module end 'content'
Timing: Jan 18 2025 04:59:34
Script end

Main resources:

Total runtime0.9330 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.0066 587.7969152.6094
Module start 'layout' 0.00660.0029 740.406339.4141
Module start 'content' 0.00950.9219 779.8203495.9922
Module end 'content' 0.93130.0016 1,275.81258.1953
Script end 0.9330  1,284.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3720160.0002
Check MTime0.00130.1390160.0001
Mysql Total
Database connection0.00110.115610.0011
Mysqli_queries0.873393.6059540.0162
Looping result0.00060.0623520.0000
Template Total0.897196.220.4486
Template load0.00290.308320.0014
Template processing0.894295.844920.4471
Template load and register function0.00040.043910.0004
states
state_id_array0.00100.103510.0010
state_identifier_array0.00170.176920.0008
Override
Cache load0.00240.2528250.0001
Sytem overhead
Fetch class attribute can translate value0.00110.119420.0006
Fetch class attribute name0.00140.152330.0005
XML
Image XML parsing0.00230.244220.0011
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00260.2828150.0002
String conversion0.00000.000640.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
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.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/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: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs