0

I have result from a pdo object fetch all as std object result which iam goiing trough like this.

{foreach from=$users key=userID item=row}
                            <tr>  
                                <td>
                                    {$row->name}
                                </td>
                               {foreach from=$regions key=regionId item=region}
                                    <td>
                                    {assign var=id value=$row->id}{assign var=cid value=$region->id}  <input type="checkbox" name="regionChecked[{$region->id}][]" value="{$row->id}" {if $assighnedUsers.$id.$cid eq 1}checked="checked"{/if}>
                                    </td>



 {/foreach}
                                <td>
                                 {$row->id|@var_dump}   <input type="checkbox" name="regionDefault" value="{$row->id}" {if $loleq $row->id}checked="checked"{/if} >
                                </td>
                                <td data-user="{$userID}">
                                    {$deleteButton}
                                </td>
                            </tr>
                        {/foreach}

Now my question is can i avoid the

{assign var=id value=$row->id}{assign var=cid value=$region->id}

Somehow? i tried varios combinations but none were working.

like $region.$row->id

1 Answer 1

1

Instead of -> use . and try

{assign var=id value=$row.id}{assign var=cid value=$region.id}
Sign up to request clarification or add additional context in comments.

1 Comment

The above posted code works. i just want to avoid to even have to assign thouse values for $assighnedUsers.$id.$cid i want to use somthing like this $assighnedUsers.$row->id.$region->id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.