JFB >> General Use >> RSS Syndication
Would you like to be able to post news to your main site and draw it from your forum the same way Jcink.com does? Learn how below. The RSS Mod shows you how.
Tutorial
To use this, your host must have two requirements:
1. Your host has PHP 2. Your host has allow_url_fopen on
How can you test for these things? Make a file called test.php and upload it to your website. Stick this code inside it:
<?php
$t=@file_get_contents("http://jcink.com");
if(!$t) echo "Your host failed to meet requirements";
if($nophp) echo "Your host doesn't have PHP";
?>
If you see either message anywhere on the page as seen in the above code, then your host does not meet the right requiremets - sorry!
This is a sample news page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>RSS Example</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type='text/css'>
html { overflow-x: auto; }
/* Body entry, change forum page background colour, default font, font size, etc. Leave text-align:center to center board content
#ipwrapper will set text-align back to left for the forum. Any other tables / divs you use must use text-align:left to re-align
the content properly. This is a work around to a known Internet Explorer bug */
BODY { font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #000; margin:0px;padding:0px;background-color:#FFF; text-align:center }
TABLE, TR, TD { font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #000; }
/* MAIN WRAPPER: Adjust forum width here. Leave margins alone to auto-center content */
#ipbwrapper { text-align:left; width:95%; margin-left:auto;margin-right:auto }
a:link, a:visited, a:active { text-decoration: underline; color: #000 }
a:hover { color: #465584; text-decoration:underline }
fieldset.search { padding:6px; line-height:150% }
label { cursor:pointer; }
form { display:inline; }
img { vertical-align:middle; border:0px }
img.attach { border:2px outset #EEF2F7;padding:2px }
.googleroot { padding:6px; line-height:130% }
.googlechild { padding:6px; margin-left:30px; line-height:130% }
.googlebottom, .googlebottom a:link, .googlebottom a:visited, .googlebottom a:active { font-size:11px; color: #3A4F6C; }
.googlish, .googlish a:link, .googlish a:visited, .googlish a:active { font-size:14px; font-weight:bold; color:#00D; }
.googlepagelinks { font-size:1.1em; letter-spacing:1px }
.googlesmall, .googlesmall a:link, .googlesmall a:active, .googlesmall a:visited { font-size:10px; color:#434951 }
li.helprow { padding:0px; margin:0px 0px 10px 0px }
ul#help { padding:0px 0px 0px 15px }
option.cat { font-weight:bold; }
option.sub { font-weight:bold;color:#555 }
.caldate { text-align:right;font-weight:bold;font-size:11px;color:#777;background-color:#DFE6EF;padding:4px;margin:0px }
.warngood { color:green }
.warnbad { color:red }
#padandcenter { margin-left:auto;margin-right:auto;text-align:center;padding:14px 0px 14px 0px }
#profilename { font-size:28px; font-weight:bold; }
#calendarname { font-size:22px; font-weight:bold; }
#photowrap { padding:6px; }
#phototitle { font-size:24px; border-bottom:1px solid black }
#photoimg { text-align:center; margin-top:15px }
#ucpmenu { line-height:150%;width:22%; border:1px solid #345487;background-color: #F5F9FD }
#ucpmenu p { padding:2px 5px 6px 9px;margin:0px; }
#ucpcontent { background-color: #F5F9FD; border:1px solid #345487;line-height:150%; width:auto }
#ucpcontent p { padding:10px;margin:0px; }
#ipsbanner { position:absolute;top:1px;right:5%; }
#logostrip { border:1px solid #345487;background-color: #3860BB;background-image:url(http://b1.jcink.com/boardservice/style_images/1/tile_back.gif);padding:0px;margin:0px; }
#submenu { border:1px solid #BCD0ED;background-color: #DFE6EF;font-size:10px;margin:3px 0px 3px 0px;color:#3A4F6C;font-weight:bold;}
#submenu a:link, #submenu a:visited, #submenu a:active { font-weight:bold;font-size:10px;text-decoration: none; color: #3A4F6C; }
#userlinks { border:1px solid #C2CFDF; background-color: #F0F5FA }
#navstrip { font-weight:bold;padding:6px 0px 6px 0px; }
.activeuserstrip { background-color:#BCD0ED; padding:6px }
/* Form stuff (post / profile / etc) */
.pformstrip { background-color: #D1DCEB; color:#3A4F6C;font-weight:bold;padding:7px;margin-top:1px }
.pformleft { background-color: #F5F9FD; padding:6px; margin-top:1px;width:25%; border-top:1px solid #C2CFDF; border-right:1px solid #C2CFDF; }
.pformleftw { background-color: #F5F9FD; padding:6px; margin-top:1px;width:40%; border-top:1px solid #C2CFDF; border-right:1px solid #C2CFDF; }
.pformright { background-color: #F5F9FD; padding:6px; margin-top:1px;border-top:1px solid #C2CFDF; }
/* Topic View elements */
.signature { font-size: 10px; color: #339; line-height:150% }
.postdetails { font-size: 10px }
.postcolor { font-size: 12px; line-height: 160% }
.normalname { font-size: 12px; font-weight: bold; color: #003 }
.normalname a:link, .normalname a:visited, .normalname a:active { font-size: 12px }
.unreg { font-size: 11px; font-weight: bold; color: #900 }
.post1 { background-color: #F5F9FD }
.post2 { background-color: #EEF2F7 }
.postlinksbar { background-color:#D1DCEB;padding:7px;margin-top:1px;font-size:10px; background-image: url(http://b1.jcink.com/boardservice/style_images/1/tile_sub.gif) }
/* Common elements */
.row1 { background-color: #F5F9FD }
.row2 { background-color: #DFE6EF }
.row3 { background-color: #EEF2F7 }
.row4 { background-color: #E4EAF2 }
.darkrow1 { background-color: #C2CFDF; color:#4C77B6; }
.darkrow2 { background-color: #BCD0ED; color:#3A4F6C; }
.darkrow3 { background-color: #D1DCEB; color:#3A4F6C; }
.hlight { background-color: #DFE6EF }
.dlight { background-color: #EEF2F7 }
.titlemedium { font-weight:bold; color:#3A4F6C; padding:7px; margin:0px; background-image: url(http://b1.jcink.com/boardservice/style_images/1/tile_sub.gif) }
.titlemedium a:link, .titlemedium a:visited, .titlemedium a:active { text-decoration: underline; color: #3A4F6C }
/* Main table top (dark blue gradient by default) */
.maintitle { vertical-align:middle;font-weight:bold; color:#FFF; padding:8px 0px 8px 5px; background-image: url(http://b1.jcink.com/boardservice/style_images/1/tile_back.gif) }
.maintitle a:link, .maintitle a:visited, .maintitle a:active { text-decoration: none; color: #FFF }
.maintitle a:hover { text-decoration: underline }
/* tableborders gives the white column / row lines effect */
.plainborder { border:1px solid #345487;background-color:#F5F9FD }
.tableborder { border:1px solid #345487;background-color:#FFF; padding:0; margin:0 }
.tablefill { border:1px solid #345487;background-color:#F5F9FD;padding:6px; }
.tablepad { background-color:#F5F9FD;padding:6px }
.tablebasic { width:100%; padding:0px 0px 0px 0px; margin:0px; border:0px }
.wrapmini { float:left;line-height:1.5em;width:25% }
.pagelinks { float:left;line-height:1.2em;width:35% }
.desc { font-size:10px; color:#434951 }
.edit { font-size: 9px }
.searchlite { font-weight:bold; color:#F00; background-color:#FF0 }
#QUOTE { white-space:normal; font-family: Verdana, Arial; font-size: 11px; color: #465584; background-color: #FAFCFE; border: 1px solid #000; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px }
#CODE { white-space:normal; font-family: Courier, Courier New, Verdana, Arial; font-size: 11px; color: #465584; background-color: #FAFCFE; border: 1px solid #000; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px }
.copyright { font-family: Verdana, Tahoma, Arial, Sans-Serif; font-size: 9px; line-height: 12px }
.codebuttons { font-size: 10px; font-family: verdana, helvetica, sans-serif; vertical-align: middle }
.forminput, .textinput, .radiobutton, .checkbox { font-size: 11px; font-family: verdana, helvetica, sans-serif; vertical-align: middle }
.thin { padding:6px 0px 6px 0px;line-height:140%;margin:2px 0px 2px 0px;border-top:1px solid #FFF;border-bottom:1px solid #FFF }
.purple { color:purple;font-weight:bold }
.red { color:red;font-weight:bold }
.green { color:green;font-weight:bold }
.blue { color:blue;font-weight:bold }
.orange { color:#F90;font-weight:bold }
</style>
</head>
<body>
<?php
// rss function by seanj.jcink.com
function rss_read($s){
preg_match_all("/<item>([\W\w]*)<\/item>/Ui",$s,$match);
$return=array();
foreach($match[1] as $k1=>$v) {
preg_match_all("/<(pubdate|title|description|link|name)>(.*)<\/\\1>/Ui",$v,$match2);
foreach($match2[1] as $k=>$v) $return[$k1][$v]=preg_replace("/^<!\[CDATA\[([\w\W]*)\]\]>$/","\\1",$match2[2][$k]);
}
return $return;
}
$rssarray=rss_read(file_get_contents("http://support.b1.jcink.com/backend.php?feedforums=1"));
for ($counter = 0; $counter <= 2; $counter++)
{
$rssarray[$counter]['pubDate']=str_replace("+0000", "", $rssarray[$counter]['pubDate']);
?>
<table><td width='1000px'>
<div class='tableborder'>
<div class='maintitle'><?php echo $rssarray[$counter]['title']; ?></div>
<div class='plainborder'>
<div align='left' class='titlemedium'>
<div align="left"><b>Posted By: </b> <?php echo $rssarray[$counter]['name']; ?> - <?php echo $rssarray[$counter]['pubDate']; ?></b></div>
</div>
</div>
<div class='textinput2' width='100%' style='line-height:150%' align='left'><?php echo $rssarray[$counter]['description']; ?>
</div>
</div>
<br /><br />
<?php
}
?></td>
</table>
</body>
</html>
Note this line:
$rssarray=rss_read(file_get_contents("http://support.b1.jcink.com/backend.php?feedforums=1"));
This link is what you must edit to start displaying news, in between the quotes. Let's change that link to suit your board:
http://support.b1.jcink.com/backend.php?feedforums=1
First, change “support” to your b1.jcink.com boards name. feedforums= is a forum id collection. These forums you draw news from MUST BE ACCESSABLE BY GUESTS! or it will not work.
In the support board's case:
http://forum.jcink.com/index.php?showforum=1
The news forum has the id of 1, and is access able by guests. So we set feedforums=1.
The news script supports multiple forums as well. Pretend we wanted to also show news from
http://forum.jcink.com/index.php?showforum=38
Then we would modify the link in red like so:
http://forum.jcink.com/index.php?showforum=1,38
Add commas for every other forum id you wish to add into the RSS feed.
That's all there is to it.


