2009-04-29, 08:12 AM
Does anyone know a php code or a mod that can parse the rss feed URL you get from the Forum's RSS Syndication? I want to have the latest forum posts from one of my forum's sections to appear on the main page of my website.
function StripMyBBTags($Post)
{
// ** Strip HR
$Post = str_replace('[hr]', '', $Post);
// ** Strip Quotes
$QuoteIndex = strpos($Post, '[quote=');
while($QuoteIndex!==false)
{
$QuoteLength = (strpos($Post, '[/quote]', $QuoteIndex) - $QuoteIndex) + 8;
$Post = substr_replace($Post, '', $QuoteIndex, $QuoteLength);
$QuoteIndex = strpos($Post, '[quote=');
}
$Post = str_replace('[/quote]', '', $Post);
// ** Strip Images
$ImageIndex = strpos($Post, '[img]');
while($ImageIndex!==false)
{
$ImageLength = (strpos($Post, '[/img]', $ImageIndex) - $ImageIndex) + 6;
$Post = substr_replace($Post, '', $ImageIndex, $ImageLength);
$ImageIndex = strpos($Post, '[img]');
}
$Post = str_replace('[/img]', '', $Post);
// ** Strip URL
$URLIndex = strpos($Post, '[url=');
if($URLIndex!==false)
{
$URLCloseIndex = strpos($Post, ']', $URLIndex);
$Post = substr_replace($Post, '', $URLIndex, ($URLCloseIndex - $URLIndex) + 1);
$Post = str_replace('[/url]', '', $Post);
}
// ** Strip Size
$SizeIndex = strpos($Post, '[size=');
if($SizeIndex!==false)
{
$SizeCloseIndex = strpos($Post, ']', $SizeIndex);
$Post = substr_replace($Post, '', $SizeIndex, ($SizeCloseIndex - $SizeIndex) + 1);
$Post = str_replace('[/size]', '', $Post);
}
// ** Strip Font
$FontIndex = strpos($Post, '[font=');
if($FontIndex!==false)
{
$FontCloseIndex = strpos($Post, ']', $FontIndex);
$Post = substr_replace($Post, '', $FontIndex, ($FontCloseIndex - $FontIndex) + 1);
$Post = str_replace('[/font]', '', $Post);
}
// ** Strip common formatting
$Post = str_replace('[b]', '', $Post);
$Post = str_replace('[/b]', '', $Post);
$Post = str_replace('[u]', '', $Post);
$Post = str_replace('[/u]', '', $Post);
$Post = str_replace('[i]', '', $Post);
$Post = str_replace('[/i]', '', $Post);
return $Post;
}
Quote:Find a third party RSS reader script for your site and then goto [your forum url]/misc.php?action=syndication
(2009-04-29, 03:49 PM)windrider07 Wrote: [ -> ]carudden, what exactly does your code do and where do I put it at?
Quote:SELECT
pos.tid,
pos.pid,
pos.subject,
pos.message,
pos.uid,
pos.username
FROM mybb_posts pos
ORDER BY pos.dateline DESC
LIMIT 0,4
$Message = StripMyBBTags(mysql_result($result, $i, "message"));