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?
thnx
but i didn't meant that
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
can you please give the code
(so i only have to change the config/links or so?) Because i'm a little noobish with this sort of things
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:
- rss_cache.inc
- rss_fetch.inc
- rss_parse.inc
- rss_utils_inc
- 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>>></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.
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...
Greets,
Michael
really thnx
but i have only one question:
what's a Feed-URL?
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
:
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
thnx thnx thnx x 1000 times!
Great!
I think the error occured because you set a .htaccess to protect the directory (username & password). So the script could not fetch the feed.
Greets,
Michael