我需要过滤和重新排序RSS
提要。
使用PHP
,我将如何检测外壳中是否有链接url=""
?
其中大部分将是空的,但我想将在此标签中具有链接的整个项目移动到顶部。
这是我将使用的代码示例。我猜我会用isset
? 就像是:
if (isset($enclosure)){
HOW WOULD I SELECT THE PARENT ITEM? AND EVERYTHING IN IT? AND THEN MOVE IT TO THE TOP?
}
<item>
<title><![CDATA[Article title 1]]></title>
<link><![CDATA[http://www.articlelinkone.com]]></link>
<pubDate><![CDATA[Tue, 26 Feb 2013 15:45:00 EDT]]></pubDate>
<description><![CDATA[Article discription 1<br />Some HTML will exist]]></description>
<enclosure url="" type="image/jpeg"></enclosure>
<thumbnail url="" type="image/jpeg"></thumbnail>
<summary><![CDATA[Summary for article]]></summary>
<guid><![CDATA[Guide for article]]></guid>
<source url="http://www.article.com/"/>
</item>
<item>
<title><![CDATA[Article title 1]]></title>
<link><![CDATA[http://www.articlelinkone.com]]></link>
<pubDate><![CDATA[Tue, 26 Feb 2013 15:45:00 EDT]]></pubDate>
<description><![CDATA[Article discription 1<br />Some HTML will exist]]></description>
<enclosure url="" type="image/jpeg"></enclosure>
<thumbnail url="" type="image/jpeg"></thumbnail>
<summary><![CDATA[Summary for article]]></summary>
<guid><![CDATA[Guide for article]]></guid>
<source url="http://www.article.com/"/>
</item>
<item>
<title><![CDATA[Article title 1]]></title>
<link><![CDATA[http://www.articlelinkone.com]]></link>
<pubDate><![CDATA[Tue, 26 Feb 2013 15:45:00 EDT]]></pubDate>
<description><![CDATA[Article discription 1<br />Some HTML will exist]]></description>
<enclosure url="http://articleone.com/image1.jpg" type="image/jpeg"></enclosure>
<thumbnail url="http://articleone.com/thumb/image1.jpg" type="image/jpeg"></thumbnail>
<summary><![CDATA[Summary for article]]></summary>
<guid><![CDATA[Guide for article]]></guid>
<source url="http://www.article.com/"/>
</item>
<item>
<title><![CDATA[Article title 1]]></title>
<link><![CDATA[http://www.articlelinkone.com]]></link>
<pubDate><![CDATA[Tue, 26 Feb 2013 15:45:00 EDT]]></pubDate>
<description><![CDATA[Article discription 1<br />Some HTML will exist]]></description>
<enclosure url="" type="image/jpeg"></enclosure>
<thumbnail url="" type="image/jpeg"></thumbnail>
<summary><![CDATA[Summary for article]]></summary>
<guid><![CDATA[Guide for article]]></guid>
<source url="http://www.article.com/"/>
</item>