Simplepie 包括不存在的幻象外壳
我将两个提要与附件结合起来,没有附件的项目将显示为空附件。
以下代码中的违规位以粗体显示:
<item>
<title><?echo $item->get_title(); ?></title>
<guid><? echo $item->get_permalink(); ?></guid>
<link><? echo $item->get_permalink(); ?></link>
**<? if ($enclosure = $item->get_enclosure()) {echo "<enclosure url='"
.$enclosure->get_link() ."' length='" .$enclosure->get_length() ."' type='"
.$enclosure->get_type() ."' />";} ?>**
<description>
<? echo $item->get_title(); ?>
</description>
</item>
没有附件的项目显示为空附件 URL、长度和类型:
所有真实的附件都会按其应有的方式显示,包括网址、长度和类型。我在 Simplepie 支持页面上阅读了一些帖子,但没有找到解决方案。
谢谢!
I am combining two feeds, with enclosures, and items that don't have enclosures are showing up with empty enclosures.
Here's the code with the offending bit in bold:
<item>
<title><?echo $item->get_title(); ?></title>
<guid><? echo $item->get_permalink(); ?></guid>
<link><? echo $item->get_permalink(); ?></link>
**<? if ($enclosure = $item->get_enclosure()) {echo "<enclosure url='"
.$enclosure->get_link() ."' length='" .$enclosure->get_length() ."' type='"
.$enclosure->get_type() ."' />";} ?>**
<description>
<? echo $item->get_title(); ?>
</description>
</item>
Items with no enclosures show up with an empty enclosure url, length, and type:
All real enclosures show up as they should with url, length and type. I read a few threads on the Simplepie support page, but came up with no solution.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不了解 Simplepie,但看看代码,
$item->get_enclosure()
可能返回一个计算结果为true
的对象,但为空。因此,也许您应该将if
的条件更改为:I don't know about Simplepie, but looking at the code,
$item->get_enclosure()
probably returns an object that evaluates totrue
, but is empty. So maybe you should change the condition of theif
to: