SimplePortal

Support => English Support => Topic started by: gcifuentes95 on December 07, 2016, 08:00:00 PM

Title: Get only the articles in rss
Post by: gcifuentes95 on December 07, 2016, 08:00:00 PM
How do for get only the articles in RSS? I want make a feed only with the articles, but I don't know how. I mean, with the action ".xml", only get notifications from the articles, like in Wordpress.

Thanks in advance!
Title: Re: Get only the articles in rss
Post by: emanuele on December 08, 2016, 08:46:29 AM
I don't remember a specific function to have a feed from articles, but I may be terribly wrong, because I'm not that expert in that particular area... :-[
Title: Re: Get only the articles in rss
Post by: gcifuentes95 on December 09, 2016, 10:16:35 PM
I don't remember a specific function to have a feed from articles, but I may be terribly wrong, because I'm not that expert in that particular area... :-[

Well, indeed, there isn't such a function. I searched in the "news.php" (I should have make this in first place  :P), but I just couldn't found it.
Anyway, I managed to solve the issue. The solution maybe sound simple, but, I just suck in database's stuff. I'll put it here, in case it may be useful to someone.

First of all, you must localize the "news.php" file (in "Source" folder). Now, you must search the following line:

Code: [Select]
'profile' => array('getXmlProfile', null),
And put bellow of it:

Code: [Select]
'articulos' => array('getXmlArticulos', null),

"articulos" ("articles" in Spanish), you can change it for the variable you want (e.g. "articles").

In this way, you are creating a "subaction" for the ".xml" action with the name "articulos".

Now, you must create the "getXmlArticulos" function. This is the most important part.

Here, you only copy-paste all the "getXmlNews" function to the final of php file (obviously, before the "?>"), and replace the variable name with "getXmlArticulos".
Then, you must search the follow code line inside of "getXmlArticulos", not in "getXmlNews" :

Code: [Select]
topics AS t

And replace with:

Code: [Select]
sp_articles AS a
INNER JOIN {db_prefix}topics AS t ON(t.id_first_msg = a.id_message)

In this way, you get a "xml" similar to with subaction "news", but only with the articles.

For get the .xml, now you only must type in the browser bar "www.yourdomain.com/index.php?action=.xml;sa=articulos;type=rss;limit=5".

Well, anyway, thanks for the support!

PD: If something it sounded weird, sorry, but I'm not used to write in English  :-[.
Title: Re: Get only the articles in rss
Post by: Squirtle on February 13, 2017, 01:43:25 AM
How do for get only the articles in RSS? I want make a feed only with the articles, but I don't know how. I mean, with the action ".xml", only get notifications from the articles, like in Wordpress.

Thanks in advance!

Did you get your feed to work?
SimplePortal 2.3.8 © 2008-2024, SimplePortal