How to display latest topics using rss

The GYM Sitemaps and RSS module and it's plug-ins.
Google Yahoo MSN Sitemaps (United 0.9).
RSS 2.0 Feeds and Yahoo! urllist.txt.

Moderator: Moderators

How to display latest topics using rss

Postby maky » Tue Apr 24, 2007 7:28 am

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.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Advertisement

Postby dcz » Tue Apr 24, 2007 9:43 am

And welcome :D

So with Gym sitemaps, you have several type of feed per forum :

http://www.phpbb-seo.com/boards/gym-sitemaps-rf44.xml
http://www.phpbb-seo.com/boards/gym-sitemaps-rf44-m.xml
http://www.phpbb-seo.com/boards/gym-sit ... 44-l-m.xml

And if you check "First message" in ACP, you'll be as well outputting the first message content in these.

So, with magpie for example, it's possible to extract the three first items of this feed for example :

http://www.phpbb-seo.com/boards/gym-sit ... 44-s-m.xml

And parse them into your home page.
As well you can check all available feeds using the channels channel (:lol:) :
http://www.phpbb-seo.com/boards/channels-rss-m.xml
http://www.phpbb-seo.com/boards/channels-rss-s-m.xml
http://www.phpbb-seo.com/boards/channels-rss-l-m.xml
http://www.phpbb-seo.com/boards/channels-rss.xml

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby maky » Tue Apr 24, 2007 9:50 am

:(

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.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Postby dcz » Tue Apr 24, 2007 10:19 am

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: Select all
<?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: Select all
<?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: Select all
    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 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby mhmdkhamis » Tue Apr 24, 2007 10:35 am

general control :D
mhmdkhamis
PR4
PR4
 
Posts: 437
Joined: Sun Nov 26, 2006 11:15 pm
Location: egypt

Postby maky » Tue Apr 24, 2007 10:39 am

Thanks a lot ... I already have magpierss and will let u know once the mission is accomplished.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Postby maky » Tue Apr 24, 2007 11:46 am

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.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Postby dcz » Tue Apr 24, 2007 11:57 am

Just use a forum feed, like : http://www.phpbb-seo.com/boards/gym-sit ... 44-s-m.xml instead of a general one, as in the example :

Code: Select all
<?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: Select all
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 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby maky » Tue Apr 24, 2007 12:56 pm

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: Select all
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.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Postby dcz » Tue Apr 24, 2007 1:05 pm

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: Select all
      // 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: Select all
      // Forum stats
      $forum_stats = "";

And :

Code: Select all
         $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 :
Code: Select all
         $forum_stats = "";


And :

Code: Select all
      $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 :
Code: Select all
         $forum_stats = "";


If you prefer.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby maky » Wed Apr 25, 2007 3:17 am

Ok I got the rss feed on my Homepage :D Thanks.
But still there is one thing.... its showing the latest replies not the latest Topics.
maky
 
Posts: 6
Joined: Tue Apr 24, 2007 7:21 am

Postby dcz » Wed Apr 25, 2007 12:35 pm

dcz wrote:And if you check "First message" in ACP, you'll be as well outputting the first message content in these.


The problem being, this setting so far applies to all feeds, but you can even only output the first message with this setting, if you set First message to true and last to false ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm


Return to GYM Sitemaps phpBB2

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests