Show Children

Show Children

Thursday 20 May 2010 1:15:19 am - 1 reply

Author Message

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.

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.