开发者

passing variable to partial loop

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜