TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 606
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 404
  • Total: 404

RSS feed for front page articles?

Started by citron, May 04, 2007, 01:40:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

H4rm0nd

For me it's articles/categories if I understand your question correctly.

In other words.  I write an article in x category, and I post it on my front page.  Some guy who's reading it can decide to subscribe to that category of articles, or even all categories via rss.

If you're asking if an alteration needs to be to the rss block or the article block itself, I don't know.  Either would be fine with me.

blue-c

Yeah Ichbin you are correct, I would like a way for something like newsnow to get an RSS feed of my articles.

dont know if this is at all possible

bloc

Ok, good. I wasn't certain what you meant. TP 1.0 will see al ot of new features, and RSS feed for the articles/categories will be on that list.

Greyhound

That is good to hear.  I've been wanting this as well.  Actually, I was just searching for this on this site. 

Any idea when 1.0 is going to be available?

Ken.

Quote from: Greyhound on March 25, 2008, 03:09:12 PM

Any idea when 1.0 is going to be available?

The 'stock' answer is, "When its ready"... there is no date set for the next release, nor will one be set.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

sheik28

Quote from: Bloc on October 20, 2007, 08:36:55 AM
Ok, good. I wasn't certain what you meant. TP 1.0 will see al ot of new features, and RSS feed for the articles/categories will be on that list.
Hi. Is there any update to this or am I missing it?
I am running TP 1.0.5

bloc

This issue hasn't been adressed yet.

sheik28

Thanks for the quick reply.
And...
Thanks for all of your hard work, TP is a great addition to SMF.

knytphal

Just to throw my two cents in the ring, I would love to see this feature as well.  Either for articles or for the first post in a certain category within the forum itself.

Would this be something that's difficult to write?  I'm tempted to go ahead and see about writing an SMF mod to do this....

Sandriell

#19
This is, for the most part, no means perfect or complete. It does not in fact account for every situation that the front page could be set up for. This will only work for situations where ONLY articles are displayed on the front page. It will not show PHP based articles either. This was all I needed, so all I coded for and it works great for me.

I am however providing it regardless because it could perhaps provide a jumping off point for someone who would like to expand on it.

For TP 0.9.8 and SMF 1.1.7

This is the function to be included in News.php:

function getXmlArticles($xml_format)
{
global $db_prefix, $user_info, $scripturl, $modSettings, $board, $context;
global $query_this_board, $func;

$query = db_query(
"SELECT id, date, subject, body, author, views, category
FROM {$db_prefix}tp_articles
WHERE frontpage = 1 AND approved = 1 AND off = 0 AND useintro >= 0
ORDER BY date DESC
LIMIT $_GET[limit]", __FILE__, __LINE__);

$data = array();
while ($row = mysql_fetch_assoc($query))
{
// Limit the length of the article, if the option is set.
if (!empty($modSettings['xmlnews_maxlen']) && $func['strlen'](str_replace('<br />', "\n", $row['body'])) > $modSettings['xmlnews_maxlen'])
$row['body'] = strip_tags(strtr($func['substr'](str_replace('<br />', "\n", html_entity_decode($row['body'])), 0, $modSettings['xmlnews_maxlen'] + 50), array("\n" => '<br />'))) . '...';

//$row['body'] = $row['useintro'] == -1 ? $row['body'] : html_entity_decode($row['body']);

if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?page=' . $row['id'],
'description' => cdata_parse($row['body']),
'author' => $row['author'],
'category' => cdata_parse($context['TPortal']['catnames'][$row['category']]),
'pubDate' => gmdate('D, d M Y H:i:s \G\M\T', $row['date']),
'guid' => $scripturl . '?page=' . $row['id'],
);
elseif ($xml_format == 'rdf')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?page=' . $row['id'],
'description' => cdata_parse($row['body']),
);
elseif ($xml_format == 'atom')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?page=' . $row['id'],
'summary' => cdata_parse($row['body']),
'author' => array('name' => $row['author']),
'created' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $row['date']),
'issued' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $row['date']),
'modified' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $row['date']),
'id' => $scripturl . '?page=' . $row['id'],
);
// A lot of information here.  Should be enough to please the rss-ers.
else
$data[] = array(
'time' => strip_tags(timeformat($row['date'])),
'id' => $row['id'],
'subject' => cdata_parse($row['subject']),
'body' => cdata_parse($row['body']),
'link' => $scripturl . '?page=' . $row['id'],
);
}
mysql_free_result($request);

return $data;
}


Additionally, a small change would need to be made to the ShowXmlFeed() function within the same file.

// List all the different types of data they can pull.
$subActions = array(
'recent' => array('getXmlRecent', 'recent-post'),
'news' => array('getXmlNews', 'article'),
'members' => array('getXmlMembers', 'member'),
'profile' => array('getXmlProfile', null),
);


CHANGED TO

// List all the different types of data they can pull.
$subActions = array(
'recent' => array('getXmlRecent', 'recent-post'),
'news' => array('getXmlNews', 'article'),
'articles' => array('getXmlArticles', 'news'),
'members' => array('getXmlMembers', 'member'),
'profile' => array('getXmlProfile', null),
);

This website is proudly hosted on Crocweb Cloud Website Hosting.