开发者

passing variable to partial loop

开发者 https://www.devze.com 2023-02-06 11:31 出处:网络
Could it be possible to pass the values in partial loop. for code EDIT:: in my file where partial is called, i\'ve another array to pass. and i want S/N for array

Could it be possible to pass the values in partial loop. for code

EDIT:: in my file where partial is called, i've another array to pass. and i want S/N for array

 <?php echo $this->partialLoop("partials/destination.phtml", $this->deslist);?> 

and i my part开发者_StackOverflowial/destination.phtml file i have

<td><?php echo ++$count; ?></td>

i am getting warning message

    Notice: Undefined variable: count in 
    /var/www/globaltours.com/application/modules/admin/views/scripts/partials/destination.phtml 
    on line 2 1

i wanted to display the count(order) of the items


View variables are in $this; use $this->count to access the count variable:

<td><?php echo ++$this->$count; ?></td>

Assuming you have passed the variable to the view like this:

$view->partialLoop('view-script.phtml', array(
    // loop 1
    array(
        'count' => 0,
        'other_variable' => 'value',
        'other_variable' => 'value',
    ),
    // loop n
    array(
        'count' => 0,
        'other_variable' => 'value',
        'other_variable' => 'value',
    ),
));


You miss something like:

$count = 0;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号