0

ビュー内で setData 変数をリセットするにはどうすればよいですか?

例: view.phtml:

$this->getChild('additional')->setData('foo', 'Bar'); 


if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
    <?php foreach ($detailedInfoGroup as $alias => $html):?>
       <?php echo $html ?>
    <?php endforeach;?>
<?php endif;

属性.phtml

echo $this->getData('foo'); // returns: Bar

データを再度設定しようとしているが、(view.phtml 内の) 次のような別の値を使用している場合:

view.phtml:

$this->getChild('additional')->setData('foo', 'Second'); 


if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
    <?php foreach ($detailedInfoGroup as $alias => $html):?>
       <?php echo $html ?>
    <?php endforeach;?>
<?php endif;

属性.phtml

echo $this->getData('foo'); // it still returns: Bar

この変数fooを更新するにはどうすればよいですか?

ありがとう、

マルティン

4

1 に答える 1