本文介绍了TYPO3:从Extbase中的文件引用中获取路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Fluid和Extbase(TYPO3 6.1)创建了一个自定义内容元素,您可以在其中定义图片.在图片设置中,我可以设置一个以文件为目标的img链接.

i've created a Custom Content Element with Fluid and Extbase (TYPO3 6.1), in which you can define a picture.In the picture-settings i can set a img-link, which is targetting a file.

在我的控制器中,我可以使用以下方式访问此数据

In my Controller i can access this data with

$this->configurationManager->getContentObject();

但是我只是获得此设置的文件引用,没有路径.像这样:

But i just get a file-reference for this setting and no path. like this:

file:1206

我在Google上搜索了很多,但没有找到访问路径的解决方案.有没有人有解决方案或知道配置管理器中的功能或其他功能?我已经花了几个小时解决这个问题...

I've googled a lot and i didn't find a solution to access the path. Has anybody a solution or knows maybe a function in the configurationmanager or something else? I've spend hours on this problem...

非常感谢!

推荐答案

您所拥有的是文件抽象层FAL的文件引用.

What you have there, is a file reference of FAL, the file abstraction layer.

首先,如果您将FlexForms与ActionController结合使用(或),您应该可以访问settings属性以计算FlexForm值.

First things first, if you use FlexForms in combination with ActionController (or any realisation of AbstractController) you should be able to access the settings property to compute your FlexForm values.

要计算sys_file_reference记录,应参考 FAL typo3.org 上的文档(以及永久链接的有关文件和文件夹处理的部分).

To compute sys_file_reference records, you should refer to the FAL docs on typo3.org (and the perma-linked section about file and folder handling).

通常,您应该能够在\TYPO3\CMS\Extbase\Domain\Model\FileReference对象上调用getOriginalResource().有关更具体的示例,请参考文档链接或查看 Wiki 以获取示例处理FileReferences.

In general, you should be able to call getOriginalResource() on a \TYPO3\CMS\Extbase\Domain\Model\FileReference object. For more concrete examples, either refer to the doc links or have a look at the wiki for a example handling FileReferences.

如果要通过流体模板计算此类参考,可以在f:image中使用treatIdAsReference参数:

If you want to compute such reference via fluid templating, you can use the treatIdAsReference argument on f:image:

<f:image src="{imageObj.uid}" width="150" height="100" treatIdAsReference="1" />

<f:image src="{imageObj.uid}" width="150" height="100" treatIdAsReference="1" />

这篇关于TYPO3:从Extbase中的文件引用中获取路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 05:54