Examples for RSS feed

Articles and Information - phpBB 3.0 modifications and tweaks

Examples for RSS feed

Postby Mick » Sun Mar 19, 2017 1:18 pm

Example RSS feed from BBC sport: http://newsrss.bbc.co.uk/rss/sportonlin ... ty/rss.xml

You get feeds from almost anywhere, the above is just an example.

Copy and paste the feed url in to website http://feed2js.org/ 'build' area. Have a read of what you can do with it. In this example I have used a single line of feed with no header or anything but you can experiment before you generate you're code on the site to get the display you want.

Once you have your script from http://feed2js.org/ the first thing to do is remove the stupid font uppy downy thing. (you don't have to but it gets in the way and I don't like it)

In overall_header.html (single line & placed to right of 'board index' link replacing the font size thing) find:
Code: Select all
<li‚ class="rightside"><a‚ href="#"‚ onclick="fontsizeup();‚ return‚ false;"‚ onkeypress="fontsizeup();‚ return‚ false;"‚ class="fontsize"‚ title="{L_CHANGE_FONT_SIZE}">{L_CHANGE_FONT_SIZE}</a></li>‚ ‚

And replace with your generated code, an example of mine is below:
Code: Select all
<li><script‚ type="text/javascript"> <!-- try{document.charset='utf-8';}catch(err){} //-->
</script></li>

<li class="rightside"><script‚ type="text/javascript"‚ src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fnewsrss.bbc.co.uk%2Frss%2Fsportonline_uk_edition%2Ffootball%2Fteams%2Fc%2Fcardiff_city%2Frss.xml&amp;num=1&amp;utf=y"></script></li>
<li class="rightside"><b>Latest CCFC news &bull; </b></li>

Example above: I have edited the original code to conform with HTML strict. All you need to do is replace the code portion as below from that same section you have generated:

Code: Select all
src=http%3A%2F%2Fnewsrss.bbc.co.uk%2Frss%2Fsportonline_uk_edition%2Ffootball%2Fteams%2Fc%2Fcardiff_city%2Frss.xml&amp;num=1&amp;utf=y


Edit 'Latest CCFC news' to 'Latest Political news' or whatever, you're done.

To place you feed in a particular forum find: in viewforum_body.html
Code: Select all
<!-- IF S_FORUM_RULES -->
<
div class="rules">
<
div class="inner"><span‚ class="corners-top"><span></span></span>
<!--
 IF U_FORUM_RULES -->
<
a‚ href="{U_FORUM_RULES}">{L_FORUM_RULES}</a>
<!--
 ELSE -->
<
strong>{L_FORUM_RULES}</strong><br />
 {FORUM_RULES}
<!--
 ENDIF -->

<
span‚ class="corners-bottom"><span></span></span></div>
</
div>
<!--
 ENDIF --> 

After add:
Code: Select all
<!-- IF FORUM_ID == N -->

<
li><script‚ type="text/javascript">
<!--
 try{document.charset='utf-8';}catch(err){} //-->
</script></li>

<h4>Rangers‚ News</h4>

<script‚ type="text/javascript"‚ src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fnewsrss.bbc.co.uk%2Frss%2Fsportonline_uk_edition%2Ffootball%2Fteams%2Fc%2Fcardiff_city%2Frss.xml&amp;num=4&amp;desc=1&amp;utf=y"></script>

<br>

<!-- ENDIF -->

Where 'N' equals the ID of that forum, you only need the number nothing else. You will need to edit this the same as the first example for your particular site. You can duplicate the above as much as you like to get feeds in whatever forums you wish. If you want to hide this from users not logged in surround the code with:
Code: Select all
<!-- IF S_USER_LOGGED_IN -->
your code
<!-- ENDIF -->

If you want to add the same feed to multiple forums use this switch:
Code: Select all
<!-- IF FORUM_ID == N1 or FORUM_ID == N2 -->
your code
<!-- ENDIF --> 

Once you have the code running go to the http://feed2js.org/ website and in 'examples', 'share your url' you can place your website url and it will appear in the list (both mine are there) this helps a lot with indexing (don't tell anyone else it's a secret)

Note: Don't forget to make copies of any files you intend to edit and keep them in a safe place, just in case. I would be inclined to do the first bit in overall_header.html and get that working, it isn't quite so complicated. Once you have your head round that it won't be so mind bending.

Best of luck!
"The more connected we get the more alone we become" - Kyle Broflovski
User avatar
Mick
 
Posts: 24
Joined: Wed Mar 15, 2017 9:14 am

Return to Articles and information

Who is online

Users browsing this forum: No registered users and 2 guests

cron