OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Strip HTML tags in RSS feed title

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Strip HTML tags in RSS feed title

Postby aleskl » Fri Sep 21, 2012 6:40 am

Hello,

is is possible to completely remove HTML tags from RSS feed title, eg. in the template atom.tpl, the title generating line is this:
Code: Select all
<title>{$journal->getLocalizedTitle()|escape:"html"|strip} {$issue->getIssueIdentification()|escape:"html"|strip}</title>

However, the title that is generated contains HTML codes, and that is not nice to RSS feed readers.

Google Reader displays the following for our RSS feed title:
Description: <p><span><span><span lang="EN-GB"><img style="float: right; padding-left: 10px;" title="Image Analysis &amp; Stereology cover" ...


The link to the RSS feed is http://www.ias-iss.org/ojs/IAS/gateway/ ... lugin/atom

So, I would like to know if the HTML purifier has any more rigorous switches to clean text?

With kind regards,
Ales
aleskl
 
Posts: 110
Joined: Mon Apr 11, 2011 7:08 am

Re: Strip HTML tags in RSS feed title

Postby asmecher » Fri Sep 21, 2012 8:16 am

Hi Ales,

I believe strip_tags is what you're looking for, no?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Strip HTML tags in RSS feed title

Postby aleskl » Mon Sep 24, 2012 4:04 am

Thanks, that was exactly what I needed. Actually, the problem was the <subtitle> tag in the Atom feed. I used then this in the atom.tpl:
Code: Select all
<subtitle>{$description|strip_tags|trim}</subtitle>

However, the generated tag still contains some multiple spaces. I tried to use preg_replace or regex_replace at the end, but it didn't work. But I'm quite happy with the html tags stripped away.

Cheers, Ales
aleskl
 
Posts: 110
Joined: Mon Apr 11, 2011 7:08 am

Re: Strip HTML tags in RSS feed title

Postby asmecher » Tue Sep 25, 2012 9:09 am

Hi Ales,

Thanks; I've filed this at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=7935 for a closer look.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest