图像对象丢失

时间:2018-08-06 18:47:49

标签: typo3 fluid extbase

我的扩展将模型通过传递给流体

$this->view->assign('theSingleData',    $object);
$this->view->assign('theMultipleData',  $multipleObjects);

对象/数据包含图像:

f:singleData的调试给了我这个

image => TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity (uid=17069, pid=341)

完美。我可以用 <f:image....>

但是'theMultipleData'因为它是一个数组(经过测试:它是10个对象的数组),所以我以这种方式处理:

<f:for each="{theMultipleData}" as="item">
 <f:debug inline="true">{item}</f:debug>
</f:for>

这对除图像以外的所有字段都适用:

'Extbase变量转储 图片=>'1'(1个字符)'

我的物体去哪了??

1 个答案:

答案 0 :(得分:0)

如果您分配多个数据,则应使用相应的方法:

import os

from classes.carte import Carte

from fonctions.receiveRobotMoves import *
from fonctions.move import *
...
isOnExit = False
while isOnExit == False: #Tant que le robot n'est pas sur la sortie...
    #On demande au joueur la direction qu'il veut prendre
    receiveRobotMoves()

    #On fait avancer le robot
    conteneur = move(Labyrinthe, movesInformation['direction'], 
movesInformation['steps'])
    #On met à jour le labyrinthe
    Labyrinthe = conteneur

$this->view->assignMultiple($multipleObjects); 是具有键和值对的数组:

$multipleObjects

在模板中,您可以通过以下键使用这些值:$multipleObjects = [ 'key1' => $value1, 'key2' => $value2, 'key3' => $value3, ... ]; {key1}{key2},...

因此,一般而言,您可以将每对都像对待

一样进行普通分配
{key3}

我建议使用上面提到的方法$this->view->assign('key1', $value1); $this->view->assign('key2', $value2); $this->view->assign('key3', $value3); ... ,如果其他方法都没问题,它将可以使用。

有关您发现的here方法$this->view->assignMultiple()的详细信息。

相关问题