我有一个php网站,其中包含一组论坛。我想在这些特定论坛中添加关于特定主题的最新文章。所以基本上每个论坛都会有不同的文章集。我应该寻找实现RSS提要的web应用程序吗?此外,我找不到带有图片的RSS源。有可能吗?
附言:我不懂XML语言。
任何帮助都将不胜感激。感谢
您需要动态创建RSS提要并将其托管在某个地方。如果你有一个PHP网站,你就已经有了一个"web应用程序"。你可以构建一些阅读论坛类别和文章的东西,并在屏幕上吐出一个简单的RSS。然后将你的RSS图标(如果你正在做的话)链接到该页面。
创建RSS提要实际上非常简单。
例如:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>The RSS title</title>
<link>The link to this page, i.e. your feed</link>
<description>Description for the feed. Some readers use that so make it nice :)</description>
<!-- Repeat as many items as you need, i.e. as the number of your articles -->
<item>
<title>Some article title</title>
<link>http://link/to/article</link>
<description>Article description, long or short</description>
<guid>http://webdesign.about.com/rss2.0feed/entry.html</guid>
<!-- Use enclosures for elements like images audio etc. -->
<enclosure url="http://url/of/the/pic" length="size_of_the_pic" type="image/jpeg"/>
</item>
<!-- end repeat -->
</channel>
</rss>
以下是一些在线资源,可以帮助您了解:
http://webdesign.about.com/od/rss/a/aa062707.htmhttp://www.mnot.net/rss/tutorial/
my one is like this access the table where the posts is located and broadcast it to the website and put a style sheet to make it look nice
$strSql = " SELECT
topic_id,
forum_id,
post_subject,
post_time,
post_text
FROM
phpbb_posts
WHERE
forum_id in (1,2)
ORDER BY
topic_id desc
limit 0,4
";
$recNews = mysqli_query($conn1,$strSql);
$test = mysqli_num_rows($recNews);
if(empty($test)){
echo '<p> Sorry No topics has been posted at the moment.';
return;
}
else{
while ($arrNews = mysqli_fetch_array($recNews))
{
echo '<div id="tabannouncements">';
echo '<article class="newsarticle">';
echo '<header>';
echo "<li class='newstitle'> Server News *". $arrNews["post_subject"] . " Date: <date>" . date("d/m/Y",$arrNews["post_time"]) . "</date></li>";
echo '<div class="newscontent">'.substr($arrNews["post_text"],0, $post_limit).'</p>';
echo '</div>';
echo "'n";
echo "<b>";
echo "</b>";
echo '<p>'.substr($arrNews["post_text"],0, $post_limit).'</p>';
echo '<br><a href="forum/viewtopic.php?f='.$arrNews['forum_id'].'&t='.$arrNews['topic_id'].'">'.'<input type="submit" value="Read More"/></a>';
echo '</div>';
echo "'n";
echo "<b>";
echo "</b>";
}
}
}