我正在通过此客户的网站http://www.redvaultproductions.com/Latest.php展示wordpress Feed,但视频未在帖子中显示。
请注意第二个(当我写这篇文章时)帖子“Mount Bachelor,Oregon”,它有一个关于wordpress的视频 - 在这里看http://redvaultproduction.wordpress.com/2012/11/14/mount-bachelor-oregon/ - 但不在我客户的网站上。
这是文档顶部的内容
<?php
require_once('autoloader.php');
$feed = new SimplePie();
$feed->set_feed_url('http://redvaultproduction.wordpress.com/feed/');
$feed->enable_cache(true);
$feed->set_cache_location('cache');
$feed->set_cache_duration(120);
$feed->init();
$feed->handle_content_type();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
以下是每个帖子的文档内容。
<?php
$item = $feed->get_item() ?>
<div class="postTitleTop"><br />
<?php print $item->get_title(); ?></div>
<?php print $item->get_content(); ?>
有人可以帮忙解释一下吗?我找不到任何关于此的信息。
答案 0 :(得分:2)
SimplePie会自动删除这些HTML标记:'base','blink','body','doctype','embed','font','form','frame','frameset','html', 'iframe','input','marquee','meta','noscript','object','param','script','style'。
你必须指定你不想删除哪些标签:
$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
// Remove these tags from the list
$strip_htmltags = $feed->strip_htmltags;
array_splice($strip_htmltags, array_search('object', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('param', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('embed', $strip_htmltags), 1);
$feed->strip_htmltags($strip_htmltags);
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();
http://simplepie.org/wiki/reference/simplepie/strip_htmltags