SimplePortal

Customization => Custom Coding => Topic started by: processor on July 15, 2014, 09:14:55 AM

Title: How to make a RSS Feed for SP Articles?
Post by: processor on July 15, 2014, 09:14:55 AM
How to make a RSS Feed for SP Articles? Any idea how to approach this?
Title: Re: How to make a RSS Feed for SP Articles?
Post by: oNLy1 on July 26, 2014, 04:12:53 AM
put all the articles into 1 board and RSS Feed the board

Topic: Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds  (http://www.simplemachines.org/community/index.php?topic=25009.0)
Title: Re: How to make a RSS Feed for SP Articles?
Post by: [SiNaN] on July 27, 2014, 07:58:11 AM
You could also extend the code handling feeds.

Sources/News.php

Code: (Find) [Select]
'news' => array('getXmlNews', 'article'),
Code: (Replace) [Select]
'news' => array('getXmlNews', 'article'),
'articles' => array('getXmlNews', 'article'),

Code: (Find) [Select]
- are actually the latest posts. */

$done = false;

Code: (Replace) [Select]
- are actually the latest posts. */

$done = false;
if ($_GET['sa'] == 'articles')
{
$request = $smcFunc['db_query']('','
SELECT
m.smileys_enabled, m.poster_time, m.id_msg, m.subject, m.body, m.modified_time,
m.icon, t.id_topic, t.id_board, t.num_replies, b.name AS bname,
mem.hide_email, IFNULL(mem.id_member, 0) AS id_member,
IFNULL(mem.email_address, m.poster_email) AS poster_email,
IFNULL(mem.real_name, m.poster_name) AS poster_name
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}topics AS t ON (t.id_first_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}
ORDER BY a.id_message DESC
LIMIT {int:limit}',
array(
'approved' => 1,
'limit' => $_GET['limit'],
)
);
$done = true;
}

Then you could use such a query string: ?action=.xml;type=rss;sa=articles;limit=5. Check out the topic linked above on how to customize the feed.
Title: Re: How to make a RSS Feed for SP Articles?
Post by: processor on August 11, 2014, 01:44:02 PM
That works great Sinan!

I was wondering, i see you have a lot of code ready for Simpleportal, why aren't things like this included in Simpleportal as is?
Title: Re: How to make a RSS Feed for SP Articles?
Post by: [SiNaN] on August 13, 2014, 11:24:03 AM
Things get a little more complex when you try to include something in a package that's actively used on thousands of forums. I'd probably code the same feature in a different way if I were to add such a functionality. There is also the matter of making sure that the package doesn't get bloated. However, for this particular issue, I may actually come up with something for the new forum independent articles feature.
Title: Re: How to make a RSS Feed for SP Articles?
Post by: processor on August 17, 2014, 04:29:14 PM
Things get a little more complex when you try to include something in a package that's actively used on thousands of forums. I'd probably code the same feature in a different way if I were to add such a functionality. There is also the matter of making sure that the package doesn't get bloated. However, for this particular issue, I may actually come up with something for the new forum independent articles feature.

I understand, however with those innovations i think hardly anyone would really have anything against it! :) really looking forward to independent articles feature!
Title: Re: How to make a RSS Feed for SP Articles?
Post by: Cyberkid on January 02, 2015, 01:12:42 PM
You could also extend the code handling feeds.

Sources/News.php

Code: (Find) [Select]
'news' => array('getXmlNews', 'article'),
Code: (Replace) [Select]
'news' => array('getXmlNews', 'article'),
'articles' => array('getXmlNews', 'article'),

Code: (Find) [Select]
- are actually the latest posts. */

$done = false;

Code: (Replace) [Select]
- are actually the latest posts. */

$done = false;
if ($_GET['sa'] == 'articles')
{
$request = $smcFunc['db_query']('','
SELECT
m.smileys_enabled, m.poster_time, m.id_msg, m.subject, m.body, m.modified_time,
m.icon, t.id_topic, t.id_board, t.num_replies, b.name AS bname,
mem.hide_email, IFNULL(mem.id_member, 0) AS id_member,
IFNULL(mem.email_address, m.poster_email) AS poster_email,
IFNULL(mem.real_name, m.poster_name) AS poster_name
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}topics AS t ON (t.id_first_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}
ORDER BY a.id_message DESC
LIMIT {int:limit}',
array(
'approved' => 1,
'limit' => $_GET['limit'],
)
);
$done = true;
}

Then you could use such a query string: ?action=.xml;type=rss;sa=articles;limit=5. Check out the topic linked above on how to customize the feed.
what about that articles with pagination and other features that is only limited to portal pages :( can't add it to any block
SimplePortal 2.3.8 © 2008-2024, SimplePortal