MyBB Community Forums

Full Version: 'last 5 topics'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Hi, i got another question:
Can you show the 'last 5 topics' (where the last reactions are at)? So you can show that on the index of your site and if people click on that they'll go to that topic. Does anybody know this code?
I made a mod like that (Advanced Stats on Index). It does what you want, and a lot more.
You can read: http://www.mybboard.com/community/showth...p?tid=2432 for more info.
My website is cuurently off-line, so I added it to an attachment.
thnx Smile
but i didn't meant that Confused I mean that i can show the last topics on another page (so not on the forum, but just at my main site).
Hey,

I did this on MyBBoard.de (see screenshot). There the last 5 topics of the board on MyBB-Mods.de are displayed.

If you meant that, I used the syndication. I created a URL on MyBB-Mods.de with all forums and set the maximum to 5. I implemented the topics by using Magpie RSS.
that's what i mean yeah Smile
can you please give the code Toungue (so i only have to change the config/links or so?) Because i'm a little noobish with this sort of things Toungue
OK, I'll give you a short instruction what you have to do.

Instruction

1. Download the latest version of Magpie RSS here: http://magpierss.sourceforge.net and unzip the package.

2. Create a folder on your server, for example with the name "lasttopics". Upload the following files and folders of the Magpie RSS package:
  1. rss_cache.inc
  2. rss_fetch.inc
  3. rss_parse.inc
  4. rss_utils_inc
  5. folder: extlib (incl. Snoopy.class.inc)

3. Then you have to create a file called topics.php. I'll post a file of another site from me, maybe you have to change things to change the layout and you have to enter your Feed-URL.
<?php
require_once 'rss_fetch.inc';
$url='http://rss.oberberg-aktuell.de/gesamt.xml';  // URL of the feed
$MAGPIE_CACHE_ON = true; // Enables caching
$MAGPIE_CACHE_AGE = 900; // Time of caching (here: 15 minutes)
$rss = fetch_rss($url);

foreach ($rss->items as $item ) {
	$title = $item[title];
	$descr = $item[description];
	$url   = $item[link ];
	echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td>$title</td>
  </tr>
  <tr>
    <td>$descr</td>
  </tr>
  <tr>
    <td><div align=\"right\"><a href=\"$url\" target=\"_blank\">more&gt;&gt;&gt;</a></div></td>
  </tr>
</table>
<br>";
}
?>

4. After that you have to upload this file in the folder where you uploaded the other files of Mygpie RSS.

When you go to http://www.yourdomain.tld/../lasttopics/topics.php you get waht you want, the last 5 topics. Wink

5. To integrate them in your site you have to include them with

<?php include ("http://www.yourdomain.tld/../lasttopics/topics.php") ?>

I hope, that helps you...Cool

Greets,
Michael
really thnx Big Grin but i have only one question:
what's a Feed-URL? Toungue
At the bottom of the forum you find the link "Syndication". Click on it and then set the limit to 5. Click on the button to create the url and you get the url for the rss-feed. This is the URL you have to enter into the script.

Greets,
Michael
i'm getting this error Confused:


Warning: MagpieRSS: Failed to fetch http://www.nintendo-gamer.nl/forum//rss.....0&limit=5 (HTTP Response: HTTP/1.1 401 Authorization Required ) in /home/nintend1/public_html/lasttopics/rss_fetch.inc on line 238

Warning: Invalid argument supplied for foreach() in /home/nintend1/public_html/lasttopics/topics.php on line 8

What can I do to fix this?
never mind, it works Big Grin

thnx thnx thnx x 1000 times! Big Grin
Great! Big Grin

I think the error occured because you set a .htaccess to protect the directory (username & password). So the script could not fetch the feed. Wink

Greets,
Michael
Pages: 1 2 3 4 5 6