Thursday 19 February 2009 5:25:57 am
OK, I found by myself. I was trying to ask people if they knew a powerful template command which would have make it easier than what I did but anyhow, my solution is a more traditional programming way but it works. First of all I've been sorting my data by values of my combo :
{def $rubriques = fetch('content', 'list', hash('parent_node_id', $node.node_id,
'sort_by',array( 'attribute', true(),'rankings/journal' ), 'depth', 0))}
Then I've created a variable to store the values of my combo and to which I gave a default value: {def $saved_journal='-1'} and then in the template I've read the first value of my combo which has been read in the {foreach $rubriques as $r} loop of my content and I've compared it to the $saved_journal value if different, that means that I'm on a new value of News paper (journal) and I must display the Newspaper name, if not, I display the rest of data because that means that I'm always on the same name of Newspaper (journal). Then I save the current value of newspaper before closing my foreach loop: {def $saved_journal=$r.data_map.journal.data_text} It works fine.
|