Folder - show three children per line with different css?

Author Message

Osichr Hayez

Wednesday 18 January 2006 6:48:51 am

In my folder object I display the children three per line. I would like to display a differet stylesheet for the three objects on each line.

First one should have class: childrenLeft
Second one should have class: childrenMid
Third one should have class: childrenRight

Fourth one (on the next line) should then again have class: childrenLeft
and so on..

How can I get this sorted?

This part of my full folder override template looks like this:
(just like the standard right-out-of-the-box template)

- - - - -
{set list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
					     offset, $view_parameters.offset,
					     sort_by, $node.sort_array,
					     class_filter_type, "include",
					     class_filter_array, array(2),
					     limit, $page_limit ) )}
{set list_count=fetch_alias( children_count, hash( parent_node_id, $node.node_id ) )}
{/section}

<div class="content-view-children">
{section var=child loop=$list_items sequence=array(bglight,bgdark)}
    {node_view_gui view=line content_node=$child}
{/section}
</div>

- - - - -

<i>ezpublish version 3.6.4</i>

Esteban Rodriguez

Wednesday 18 January 2006 7:19:58 am

I guess the simplest way would be to use the sequence parameter to have the loop alternate between the 3 classes you want

<div class="content-view-children">
{section var=child loop=$list_items sequence=array( ChildLeft , ChildMid , ChildRight )}
   <div class="$child.sequence">
      {node_view_gui view=line content_node=$child}
   </div>
{/section}
</div>

or maybe you could pass the value of $child.sequence as a parameter to the child's line template (and use it there to add a class to some existing div) to avoid cluttering your html with further markup.

hope it helps

I have great faith in fools; self-confidence my friends call it.

http://presencia.net

Osichr Hayez

Wednesday 18 January 2006 11:54:06 pm

Thanks to you my day started with a big smile! Now I understand what the sequence parameter is all about : )

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