1

I have a problem with the parse_variables() method once my data contains an array at a certain depth:

foreach ($cvs->result_array() as $id => $row)
{
    $variables[] = array(
        'id' => $row['id'],
        'name' => $row['name'],
        'template_id' => $row['template_id'],
        'template_purchases' => $this->cv_model->template_purchases($row['template_id']), 
        'pages' => array(
            array(
                'page_count' => 1, 
                'regions' => array(
                    'region_count' => 1, 
                    'region_data' => 'something here'
                )
            )
        )
    );
}

return $this->EE->TMPL->parse_variables($tagdata, $variables);

What I'm finding is that it's fine if region_data is NOT an array. But the minute I make that an associative array I get an error:

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 1

Filename: libraries/Template.php

Line Number: 3716

And

A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: libraries/Template.php

Line Number: 3789

Is there a limit to the number of levels you can nest here? I'm trying to achieve something like this in the template:

{exp:blah:cvs
    id="{segment_3}"
    }

    {pages}
                                
        <div class="page" id="page-{page_count}" data-template-id="template-{template_id}">

            {regions}

                <div class="region" id="page-{page_count}-region-{region_count}">
                    
                    {region_content}

                </div>

            {/regions}
            
        </div>

    {/pages}

{/exp:blah:cvs}
1
  • I am getting the same error in step 2 of my checkout process and have no idea where to look or what the problem could be?
    – heinkasner
    Jul 7 '14 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.