[英]Typo3 DCE Images
I'll try to design my own content elements with DCE (Dynamic Content Elements). 我将尝试使用DCE(动态内容元素)设计自己的内容元素。 The problem I have a problem when I try to work with images. 问题我尝试使用图像时遇到问题。 I created a select field for images which works fine. 我为图像创建了一个选择字段,效果很好。 In the fluid template I have the following code for handling the image: 在流体模板中,我具有以下用于处理图像的代码:
<f:image src="{field.image}" alt="" treatIdAsReference="1" />
But if I try to insert the content element, Typo3 throws me this exeption: 但是,如果我尝试插入content元素,则Typo3会抛出此异常:
Oops, an error occurred!
No file usage (sys_file_reference) found for given UID.
More information regarding this error might be available online.
I already found out, that this is pretty sure a bug in Typo3, but how can I fix it? 我已经发现,这可以肯定是Typo3中的错误,但是我该如何解决?
Check This Tutorial and set it accordingly. 选中本教程并进行相应设置。 http://docs.typo3.org/typo3cms/extensions/dce/Tutorial/Index.html Your problem might be solved...!! http://docs.typo3.org/typo3cms/extensions/dce/Tutorial/Index.html您的问题可能已解决……!
For the Template use this code: 对于模板,请使用以下代码:
<f:for each="{dce:fal(field:'fal', contentObject:contentObject)}" as="fileReference" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" />
</f:if>
</f:for>
Notice field:'fal'
is not the variable name you set, it's part of the configuration below the variable name: 注意field:'fal'
不是您设置的变量名称,它是变量名称下方配置的一部分:
...
<foreign_match_fields>
<fieldname>fal</fieldname> <!-- Name of variable! -->
</foreign_match_fields>
...
Got it. 得到它了。 With the hint form vijay rami I found out, that you have to render images in dce like this: 通过我发现的提示表单vijay rami ,您必须像这样在dce中渲染图像:
<f:for each="{dce:fal(field:'image', contentObject:contentObject)}" as="fileReference" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" />
</f:if>
</f:for>
Of course you have to edit in the first line "field:'image'" to your name. 当然,您必须在第一行“ field:'image'”中编辑您的姓名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.