1

I am using this plugin for my website and I am struggling with problem I have. I use a multifeed system and the code looks like this :

$feed = new SimplePie();
$feed->set_feed_url($feedsArray);
$feed->init();
$feed->handle_content_type();
$feed->set_item_limit(50);

foreach ($feed->get_items() as $item){

     $data[] = array( 'title' => $item->get_title(), 'description' => $item->get_description() );

}

Everything works perfectly but, what I want is to introduce in the $data array a value like "feedUrl" which is the url used in $feedsArray for the actual item. Remember this array contains all the urls and I want the url used for the actual item where I get news.

Sorry if my explanation is a bit confusing,

Thanks in advance!

4

2 回答 2

2

用于$feed->get_permalink();提要的链接或$item->get_permalink();项目的永久链接。

更新

使用'feedUrl' => $item->get_base('href')

foreach ($feed->get_items() as $item) {

     $data[] = array( 'feedUrl' =>  $item->get_base('href'), 'title' => $item->get_title(), 'description' => $item->get_description() );

}
于 2012-10-22T15:55:59.913 回答
1

如果您想要您最初输入的完整 URL,请使用:

$item->get_feed()->subscribe_url()

http://simplepie.org/wiki/reference/simplepie/subscribe_url

于 2013-08-17T09:13:34.327 回答