nested {foreach} and {delimiter}

Author Message

Softriva .com

Wednesday 21 February 2007 6:23:50 am

Dears,

I noticed that the {delimiter} does not work in nested {foreach} is there a system limitations

{def $gnode_id=$node.node_id}
{def $gMenus=fetch(content,list, hash('parent_node_id', 59,'sort_by',array( 'priority', true() ))) $gChildern=false()}

<table>
  <tbody>
   <tr>
     {foreach $gMenus as $gMenu}
      <td>
	<table>
	  <thead>
		<tr><th>{$gMenu.name|wash}</th></tr>
          </thead>
	  <tbody>
	    <tr>
              <td>
               {set $gChildern=fetch(content,list, hash('parent_node_id', $gMenu.node_id,'sort_by',array( 'priority', true() )))}
 	       <ul>
               {foreach $gChildern as $child}
                 <li><a href={$child.url_alias|ezurl}>{$child.name|wash}</a></li>
               {/foreach}
	       </ul>
              </td>
            </tr>
          </tbody>
	</table>
        </td>
	{delimiter modulo=2}
    </tr>
    <tr>
    {/delimiter}
    {/foreach}
    </tr>
  </tbody>
</table>

Claudia Kosny

Wednesday 21 February 2007 7:46:18 am

Hi OOzy

This would be easier if you would have posted an example of what you expected and what you actually received...
Using delimiter in foreach works fine for me:

{def $array1 = array(1,2,3,4)
     $array2 = array('a','b','c','d')}
{foreach $array1 as $value1}
<br />
 {$value1} : <br />
 {foreach $array2 as $value2}
  {$value2}
 {/foreach}
{delimiter modulo=2}
  delim for array1
{/delimiter}
<br />
{/foreach}  

produces

1 :
a b c d

2 :
a b c d
delim for array1
3 :
a b c d

4 :
a b c d 

which is exactly what I would expect.

Claudia

Softriva .com

Thursday 22 February 2007 11:52:16 pm

hmmmm

Claudia,

your code produces


1 :
a b c d

2 :
a b c d

3 :
a b c d

4 :
a b c d

I am running 3.8.6.
This is weird.

André R.

Friday 23 February 2007 4:20:47 am

Claudia, are you using 3.8.7 or 3.9.1 from svn ?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Softriva .com

Friday 23 February 2007 9:39:43 am

hmmm

why 3.8.7 or 3.9.1 not 3.9?

Can I use 3.9.1? When will it be released?

Softriva .com

Friday 23 February 2007 10:16:40 am

I have just finished upgrading to 3.9 and it works ok.

Softriva .com

Friday 23 February 2007 10:26:04 am

Now, this is crazy. It don't work any more.

I have seen Claudia output. I have seen this on my site.

1 :
a b c d

2 :
a b c d
delim for array1

3 :
a b c d

4 :
a b c d 

this is crazy

Claudia Kosny

Friday 23 February 2007 11:53:59 am

Hi there

I actually tried on eZ 3.8.3, 3.8.6 and 3.9, but all of them had template compiling set to disabled (as they are my local development installations). If I enable it, it does not work anymore, no matter the system.
As I never have used the delimiter (apart from the testing for OOzy), I did not realise that this before. I assume this has been fixed in the versions Andre was mentioning, but I have not tried it.

Claudia

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