【发布时间】:2015-04-05 02:00:03
【问题描述】:
我想从 xml 提要中获取属性。 如果我在流体中调试数组,我可以将属性视为一个名称为@attributes 的数组:
array(6 items)
title => 'Test Title'
enclosure => array(1 item)
@attributes => array(3 items)
url => 'http://www.example.com/test.jpg' (55 chars)
length => '83423' (5 chars)
type => 'image/jpeg' (10 chars)
但是不能用这种语法读取 url:
enclosure.@attributes.url
也许是@符号。 是否有 Viewhelper(可能是 VHS)或我可以用来读取数据的东西?
【问题讨论】:
-
您是否已经尝试过使用
... ... -
这是一个 SimpleXMLElement。当你
<f:debug>{enclosure.@attributes}</f:debug>时,你会得到什么也看到这个:forum.typo3.org/index.php?t=msg&goto=660534&。此外,如果你有一个控制器,你应该使用标准的 SimpleXMLElement 函数并给模板一个真正的数组或者你需要的值。 -
我的方式似乎可行,@nbar 提到的替代解决方案更干净。
-
是的,但我无法访问扩展程序。