Welcome Guest, Not a member yet? Register   Sign In
[Support] Problem passing an array to a view file
#1

[eluser]kjanko[/eluser]
I'm currently using Phil's Template library in synergy with his dwoo parser implementation.
However,

Code:
$users = $this->cms->get_data('top_users');
  $this->parser->parse('dashboard', $users);

does not seem to parse

Code:
{foreach $users val}
        <tr>
         <td>&lt;input type="checkbox"&gt;&lt;/td>
         <td>{$val.username}</td>
         <td>{$val.password}</td>
         <td><a href="#">{$val.email}</a></td>
         <td>
          <a href="#" class="table-actions-button ic-table-edit"></a>
          <a href="#" class="table-actions-button ic-table-delete"></a>
         </td>
        </tr>
        {/foreach}

Doing a var_dump of $users in the view results in nothing so the array is not passed.
I had the same problem when I used $this->template->build('anything', $data) however I solved it by using $this->template->set method.
I can't use the same method because this is the ACP and I cannot use the template library.
Any help - appriciated.

Using CI 2.1




Theme © iAndrew 2016 - Forum software by © MyBB