Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-10-07 14:45:14

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Add a line to the RSS feed

Hi,

I want to add this

<img src="http://example.com/s/piwik.php?idsite=8&amp;rec=1&action_name=<txp:title />" style="border:0" alt="" />

to the default RSS feed, so that the RSS feed puts this out:

<description>
<![CDATA[
<p>bla bla bla</p>
<img src="http://example.com/s/piwik.php?idsite=8&amp;rec=1&action_name=<txp:title />" style="border:0" alt="" />
]]>
</description>

I guess it has to be placed in rss.php but I really don’t get along with the code there. Every link or something that looks similar to what I am trying to include is taken apart and recombined to a beautiful — but for me completely incomprehensible — soup of code. :)

Any help on how to accomplish this would be greatly appreciated.

Thank you very much,

Alex

Offline

#2 2013-10-07 15:02:31

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Add a line to the RSS feed

Check out rah_custom_feed. The plugin allows you to customize feed items’ body content using a rah_feed_body named form template:

<txp:body />
<img src="<txp:site_url />s/piwik.php?idsite=8&amp;rec=1&amp;action_name=<txp:title />" style="border:0" alt="" />

Last edited by Gocom (2013-10-07 15:03:14)

Offline

#3 2013-10-07 19:58:36

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Re: Add a line to the RSS feed

Hi Jukka,

using the name rah_feed_body does nonetheless require to redirect /rss to /?rah_external_output=body, right?

Then this is not what I was looking for, because I need to keep the default feed URL (/rss).

By the way, your plug-in was a big help for me anyway. But it would be just superb if there were no need to redirect the feed to a new URL.

Thank you,

Alex

Last edited by ar (2013-10-07 20:06:07)

Offline

#4 2013-10-07 20:09:30

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Add a line to the RSS feed

You could try to add

$summary .= parse('<img src="<txp:site_url />s/piwik.php?idsite=8&amp;rec=1&amp;action_name=<txp:title />" style="border:0" alt="" />');

right after the definition of summary (~line 96) in rss.php, but I would rather use a redirect.

Offline

#5 2013-10-07 21:08:33

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Add a line to the RSS feed

ar wrote:

using the name rah_feed_body does nonetheless require to redirect /rss to /?rah_external_output=body, right?

Nope, that’s a different, unrelated plugin. Rah_custom_feed replaces the feed items’ description field.

Last edited by Gocom (2013-10-07 21:11:27)

Offline

#6 2013-10-07 21:29:10

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Re: Add a line to the RSS feed

Oleg: Thank you. I didn’t try it yet but I wonder why you would prefer a redirection?

Jukka: If I knew of that plugin before… this is awesome. Thank you very much!

Last edited by ar (2013-10-07 23:57:56)

Offline

#7 2013-10-08 08:10:22

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Add a line to the RSS feed

ar wrote:

Oleg: Thank you. I didn’t try it yet but I wonder why you would prefer a redirection?

It’s more flexible and easier to maintain/update. But you don’t even need to redirect with rah_custom_feed, so there is no question.

Offline

Board footer

Powered by FluxBB