| :: |
| Author |
Message |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Tue Apr 24, 2007 7:28 am Post subject: How to display latest topics using rss |
|
|
Hi
I want to show latest 3 topics ( not replies ) from a particular forum on my home page. Phpbb is in "forum" sub-folder.
Can I use rss ( from GYM Sitemaps RC4 ) to do this. Many other rss mods have this functionality. |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
|
| Back to top |
|
 |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Tue Apr 24, 2007 9:50 am Post subject: Re: How to display latest topics using rss |
|
|
Ok but the question is how can I do that.
There is no documentatin so can u kindly help me out.
I need to post latest 3 topics from my forum vf3 like
- Subject of Topic 1 from vf3
few lines of message ... read more link
- Subject of Topic 2 from vf3
few lines of message ... read more link
- Subject of Topic 3 from vf3
few lines of message ... read more link
If it cannot be done using this MOD can u suggest some other option please. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
Posted: Tue Apr 24, 2007 10:19 am Post subject: Re: How to display latest topics using rss |
|
|
Well, you can download and install magpierss, you'll just have to upload the archive content in a folder you'll name magpie, in your forum folder/
And then create a parser.php file with something like this in it :
| Code: | <?php
// include magpierss
require_once("magpie/rss_fetch.inc");
function parser($url_feed, $nb_items = 10) {
// read the feed
$rss = fetch_rss($url_feed);
if (is_array($rss->items)) {
// limit output, only grabb most recents
$items = array_slice($rss->items, 0, $nb_items);
// list styling
$html = "<ul>\n";
foreach ($items as $item) {
$html .= "<li>";
$html .= "<a href=\"".$item['link']."\">";
$html .= $item['title']."</a><br/>";
$html .= $item['description']."</li>\n";
}
$html .= "</ul>\n";
}
return $html;
}
?> |
And upload it in your forum folder.
Off course you can change styling in this function, and build several in case you need several types of outputs, styled in a different manner.
And now you can use :
| Code: | <?php
require_once("parser.php");
echo parser("http://www.yoursite.com/rss-m.xml", 3);
?> |
To output the 3 first items of a given feed on whatever page, as long as you take care of the include paths.
The magpie class is handy, and has its own cache system for even better performances. You can set it in rss_cache.inc :
| Code: |
var $BASE_CACHE = './cache'; // where the cache files are stored
var $MAX_AGE = 3600; // when are files stale, default one hour |
I'll elaborate more on such techniques soon, but you should be ready to go with this
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
mhmdkhamis PR4

Joined: 26 Nov 2006 Posts: 436 Location: egypt
|
Posted: Tue Apr 24, 2007 10:35 am Post subject: Re: How to display latest topics using rss |
|
|
general control  |
_________________ برامج |برامج مجانية|العاب |
|
| Back to top |
|
 |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Tue Apr 24, 2007 10:39 am Post subject: Re: How to display latest topics using rss |
|
|
| Thanks a lot ... I already have magpierss and will let u know once the mission is accomplished. |
|
|
| Back to top |
|
 |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Tue Apr 24, 2007 11:46 am Post subject: Re: How to display latest topics using rss |
|
|
OK I got it working with slight modification but the problem is it outputs latest replies in general.
I need latest topics for a particular forum say vf3, which url shud I pass for that.
Also how do I remove the Horizontal Line its showing automatically. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
Posted: Tue Apr 24, 2007 11:57 am Post subject: Re: How to display latest topics using rss |
|
|
Just use a forum feed, like : http://www.phpbb-seo.com/boards/gym-sitemaps-rf44-s-m.xml instead of a general one, as in the example :
| Code: | <?php
require_once("parser.php");
echo parser("http://www.phpbb-seo.com/boards/gym-sitemaps-rf44-s-m.xml", 3);
?>
|
About the <hr> used in the feeds themselves, you could just add this in your website's css :
| Code: | hr {
clear: both;
visibility:hidden;
} |
To hide them.
Take a look at the ggs_style/rss2.css style-sheet, these are the classes used in the feeds, most of them are only used in the xsl style-sheet, but some are directly sent in the item description, so you can style your output a bit playing with them.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Tue Apr 24, 2007 12:56 pm Post subject: Re: How to display latest topics using rss |
|
|
1. How do I know the feed url of my forum that I want to fetch ? What shud be the feed url for my forum with "f=3"
2. How do I let people know to subscribe to my feeds ? I dont see any buttons in my forum for syndication.
3. rss2.css already has | Code: | hr {
clear: both;
visibility:hidden;
} |
Do I still need to use it in my css file ? Is there any other file that I can edit to stop these <hr> tags. Also they are comming at wrong place. Ideally <hr> shud come after completion of one item and before start of the other. But its comming before stats.
4. How can I remove "stats:54 replies" from the feed. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
Posted: Tue Apr 24, 2007 1:05 pm Post subject: Re: How to display latest topics using rss |
|
|
1) browse http://www.phpbb-seo.com/boards/channels-rss-s-m.xml (with your site url obviously) and pick the correct forum url from there.
2) We'll soon release a mod for this. But you can already start a topic in your forum to post the several feed's links and tell your user to browse the channel list to select feeds.
3) I was talking about the CSS used where the feed is incorporated, rss2.css is only called from the xsl style sheet.
4) The stats are added in rss_forum.php, look for :
| Code: | // Forum stats
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$l_total_post_s = ( $total_posts >= 0 ) ? $lang['Posted_articles_total'] : $lang['Posted_article_total'];
$l_total_user_s = ( $total_users >= 0 ) ? $lang['Registered_users_total'] : $lang['Registered_user_total'];
$forum_stats = sprintf($l_total_user_s, $total_users) . ' || ' . sprintf($l_total_post_s, $total_posts); |
And replace with :
| Code: | // Forum stats
$forum_stats = ""; |
And :
| Code: | $forum_stats = $lang['rss_item_stats'] . $forum_data['forum_topics'] . ' ' . (($forum_data['forum_topics'] >= 0) ? $lang['Topics'] : $lang['Topic'] );
$forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $lang['Posts'] : $lang['Post'] ); |
to be replaced with :
And :
| Code: | $forum_stats = $lang['rss_item_stats'] . $forum_data['forum_topics'] . ' ' . (($forum_data['forum_topics'] >= 0) ? $lang['Topics'] : $lang['Topic'] );
$forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $lang['Posts'] : $lang['Post'] ); |
To be replaced with :
If you prefer.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
maky
Joined: 24 Apr 2007 Posts: 6
|
Posted: Wed Apr 25, 2007 3:17 am Post subject: Re: How to display latest topics using rss |
|
|
Ok I got the rss feed on my Homepage Thanks.
But still there is one thing.... its showing the latest replies not the latest Topics. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
|
| Back to top |
|
 |
|
|