Advertisement:

Author Topic: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds  (Read 711719 times)

Offline cbsarge

  • Newbie
  • *
  • Posts: 5
I'm trying to display the latest forum feeds in a div on another site. The div will be added to that site as part of a Chrome extension that also adds a toolbar. I'm going to use the extension to append the html to an existing element of the page and use the iframe to fill it with the RSS content.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Yeah, there's still multiple better ways of doing it than that, such as using SSI.php to do it (and that doesn't even need hacking anything about), you can call SSI.php?ssi_function= and one of the names of the functions in that file, which is ready formatted for HTML.

SMF in iframes is still not clever though at least the normal security protocol won't get in your way there.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline devnullius

  • Newbie
  • *
  • Posts: 4
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #502 on: December 02, 2014, 12:15:40 PM »
sigh/index.php?action=.xml;limit=20;type=rss2

The action above displays the 20 most recent posts. Is there a way to display the 20 most recent topics?

Use ;sa=news.  This will be the first post in each topic, not the last.

Ok, I'm trying to get an RSS feed without any replies / bumps... I just need a single RSS entry for each new topic once it is posted. NOthing more than this first post, even when it's bumped / replied to.

Would it be possible?

I tried this
Code: [Select]
index.php?type=rss;action=.xml;sa=news;board=159.0;limit=25 which hardly gives any results and does not seem to be a relevant RSS feed.

Code: [Select]
index.php?type=rss;action=.xml;board=159.0;limit=25 doesn't give the results I want either... Surely, an initial-posts only RSS feed can be created, right??

ANY help / tips / pointers appreciated :)

Devvie
@devnullius
« Last Edit: December 02, 2014, 12:27:28 PM by devnullius »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #503 on: December 02, 2014, 12:21:46 PM »
index.php?type=rss;action=.xml;sa=news;board=159.0;limit=25 is correct.

It does however apply a limiter to avoid performance trouble on your forum.

News.php:
Code: [Select]
$request = $smcFunc['db_query']('', '
SELECT num_posts
FROM {db_prefix}boards
WHERE id_board = {int:current_board}
LIMIT 1',
array(
'current_board' => $board,
)
);
list ($total_posts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

$feed_title = ' - ' . strip_tags($board_info['name']);

$query_this_board = 'b.id_board = ' . $board;

// Try to look through just a few messages, if at all possible.
if ($total_posts > 80 && $total_posts > $modSettings['totalMessages'] / 10)
$context['optimize_msg']['lowest'] = 'm.id_msg >= ' . max(0, $modSettings['maxMsgID'] - 600 - $_GET['limit'] * 5);

That entire block should probably be removed.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline devnullius

  • Newbie
  • *
  • Posts: 4
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #504 on: December 02, 2014, 12:31:04 PM »
index.php?type=rss;action=.xml;sa=news;board=159.0;limit=25 is correct.

It does however apply a limiter to avoid performance trouble on your forum.

News.php:
Code: [Select]
$request = $smcFunc['db_query']('', '
SELECT num_posts
FROM {db_prefix}boards
WHERE id_board = {int:current_board}
LIMIT 1',
array(
'current_board' => $board,
)
);
list ($total_posts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

$feed_title = ' - ' . strip_tags($board_info['name']);

$query_this_board = 'b.id_board = ' . $board;

// Try to look through just a few messages, if at all possible.
if ($total_posts > 80 && $total_posts > $modSettings['totalMessages'] / 10)
$context['optimize_msg']['lowest'] = 'm.id_msg >= ' . max(0, $modSettings['maxMsgID'] - 600 - $_GET['limit'] * 5);

That entire block should probably be removed.

Thanks! Does this mean that if I don't own the forum, I'm out of luck? (sent PM too)

Devnullius

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #505 on: December 02, 2014, 12:35:17 PM »
Thank you for reading my signature.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline devnullius

  • Newbie
  • *
  • Posts: 4
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #506 on: December 02, 2014, 12:42:06 PM »
Thank you for reading my signature.

Just to give you the full link; sent PM and reply at about the same time ;p

Offline devnullius

  • Newbie
  • *
  • Posts: 4
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #507 on: December 02, 2014, 01:03:29 PM »
Thanks! Does this mean that if I don't own the forum, I'm out of luck? (sent PM too)

Devnullius

Still wondering :)

Devvie

PS: somebody implement easier Captcha's please :(

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #508 on: December 02, 2014, 01:11:35 PM »
Please don't bump your topic in minutes...

If you have no access to the files (FTP your your host's file manager) then yes, you can't really do much as the trick pointed by Arantor implies changes in code...

Captcha goes away after 10 posts.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline scotchmonster

  • Semi-Newbie
  • *
  • Posts: 77
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #509 on: January 07, 2015, 02:48:23 AM »
Thanks for pointing me to the right board Margarett.

I cant work this out to save myself so if anyone can help it is much appreciated.

I am trying to get a feed of the latest post from the last 10 topics.

Atm we are using http://thejetski.club/index.php?action=.xml;sa=new;type=rss all this gives us is the last 5 posts - sometimes all from one topic.

Any guidance is much appreciated.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #510 on: January 07, 2015, 07:39:16 AM »
sa=news (not sa=new) will give you the first post of the last 10 topics. There actually isn't a way out of the box to get any number of posts where the posts are the last post (only) of the last x topics, because that's actually less useful than you might think in practice as it becomes quite easy to miss posts in the middle of a topic.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline scotchmonster

  • Semi-Newbie
  • *
  • Posts: 77
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #511 on: January 07, 2015, 03:52:38 PM »
I see, yes that seems to be working. Is there a way to make it show 10 now instead of 5?


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #512 on: January 07, 2015, 03:55:55 PM »
Like the first page of this topic says, add ;limit=10 to the URL.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline smartmouse

  • Full Member
  • ***
  • Posts: 549
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #513 on: March 11, 2015, 06:27:19 AM »
is there any way to delete CDATA from rss?

What should i change?

How to do that?

Offline suhaneankit

  • Semi-Newbie
  • *
  • Posts: 83
  • Gender: Male
  • Happy To Help!
    • medchitchat on Facebook
    • @medchitchatcom on Twitter
    • Your Own Health Community
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #514 on: March 15, 2015, 06:24:33 AM »
My rss feed are not working at all.  :-[
7 Steps IRCTC Registration IRCTC Registration in 7 Steps
Check PNR Status IRCTC PNR Status

Offline savya_sathe

  • Newbie
  • *
  • Posts: 3
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #515 on: April 01, 2015, 04:19:04 AM »
In my blog now I can do this all tricks with XML.



Offline Low

  • Jr. Member
  • **
  • Posts: 211
    • Free Forum and Blog Hosting
Great thread! I was displaying ALL replies and messages and I simply added sa=news at the end now I only show the newest posts :)

Offline Dhayzon

  • Sophist Member
  • *****
  • Posts: 1,167
  • Gender: Male
  • DhayZone RevolutioN
    • Dhayzon on GitHub
    • @dhayzon on Twitter
    • http://dhayzon.com/
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #517 on: August 16, 2016, 05:40:27 PM »
how to get topic or post by member?

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,597
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #518 on: August 16, 2016, 05:44:23 PM »
does not look like it is possible.

Offline uamsameter

  • Semi-Newbie
  • *
  • Posts: 81
    • A Students Notebook
Re: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds
« Reply #519 on: August 22, 2016, 01:27:25 PM »
Hi,
I just got my rss feed on twitter and it seems to be tweeting every single post (all replies). I'm worried that it may become a headache for my followers in the long run.
Is there a way to show just new topics and nothing more?

Eagerly anticipating your reply.
Thanks
Wandering is free. Certainty has a price.