Welcome Guest, Not a member yet? Register   Sign In
Nested Loop with parser template
#5

[eluser]Aken[/eluser]
The parser should be able to handle this no problem. I just did a quick test and it worked fine. Here's the code, compare it to yours and see if you can find where it might not be functioning properly. Also compare your CodeIgniter version to the latest and see if it has been upgraded to include this functionality since your version.

Code:
// application/views/template.php

{chunk}
<section class="chunk">

{divs}
<div>
  {var1}, {var2}
</div>
{/divs}

</section>
{/chunk}

// Controller

  $this->load->library('parser');
  
  $data = array(
   'chunk' => array(
    array(
     'divs' => array(
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
     ),
    ),
    array(
     'divs' => array(
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
      array(
       'var1' => 'test',
       'var2' => 'hi',
      ),
     ),
    ),
   ),
  );
  
  $this->parser->parse('template', $data);


Messages In This Thread
Nested Loop with parser template - by El Forum - 05-14-2012, 01:11 AM
Nested Loop with parser template - by El Forum - 05-15-2012, 05:35 AM
Nested Loop with parser template - by El Forum - 05-15-2012, 06:48 AM
Nested Loop with parser template - by El Forum - 05-15-2012, 06:51 AM
Nested Loop with parser template - by El Forum - 05-15-2012, 12:05 PM
Nested Loop with parser template - by El Forum - 05-23-2012, 03:05 AM
Nested Loop with parser template - by El Forum - 05-23-2012, 04:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB