Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-04-22 00:49:20
- moslib
- Member
- Registered: 2005-08-11
- Posts: 39
RSS feeds and ampersands in titles
“Prevent widowed words in article titles?” – YES
This is great – but what about when creating a custom RSS feed output? … I’ve escaped the ampersands (using <txp:atb_html_special_chars>
), but the feed validator says “title should not contain HTML”…
Is there any way to remove the widow preventer in this particular instance?
Or is a bit of HTML like that in the title no big deal?
thanks
Offline
Re: RSS feeds and ampersands in titles
You’d have to do the exact opposite: unescape the already escaped ampersand instead of escaping an escaped ampersand.
Offline
Re: RSS feeds and ampersands in titles
Patch to fix this in article titles:
--- rss.php (revision 2859)
+++ rss.php (working copy)
@@ -82,7 +82,7 @@
$count = ($comments_count > 0) ? ' ['.$comments_count.']' : '';
} else $count = '';
- $Title = htmlspecialchars(strip_tags($Title)).$count;
+ $Title = escape_title(strip_tags($Title)).$count;
$thisauthor = get_author_name($AuthorID);
fixed in SVN changeset 2861
Last edited by ruud (2008-04-22 09:52:58)
Offline
#4 2008-04-22 23:45:01
- moslib
- Member
- Registered: 2005-08-11
- Posts: 39
Re: RSS feeds and ampersands in titles
Ruud, this fix applies if you’re using Txp’s built-in feeds capability, right?
I’m using a page template – with the <txp:mg_setheader />
tag to set the content type to ‘text/xml’
Reason – to provide an events listing that’s based on the chronological order of events, rather than when they were inputted into Txp. It’s also used for other content items that are time-based and handled with zem_event, but need to be shown in a similar chronological order, and removed when the ‘event’ has expired.
Maybe I should try another plugin to strip HTML – that might be the simple solution… will go try…
EDIT: nope doesn’t work. Probably need some custom code or plugin to specifically replace the  
with a single space while at the same time converting any ampersands in the title
going round in circles here!
Last edited by moslib (2008-04-23 00:06:44)
Offline
Re: RSS feeds and ampersands in titles
Hi moslib,
try no_widow="1"
in the <txp:title />
tag.
Offline
#6 2008-04-23 01:42:10
- moslib
- Member
- Registered: 2005-08-11
- Posts: 39
Re: RSS feeds and ampersands in titles
Thanks Maniqui – I don’t see any difference in the output though. And looking in taghandlers.php, can’t see an attribute for that tag. (Doesn’t mean it’s not there! Not an expert.)
Offline
Re: RSS feeds and ampersands in titles
I think I was wrong: no_widow="0"
<- there is a widow, so there isn’t a  
Sorry.
Try that one.
Offline
#8 2008-04-23 01:58:00
- moslib
- Member
- Registered: 2005-08-11
- Posts: 39
Re: RSS feeds and ampersands in titles
Ah yes – thank you! Too easy.
Offline
Re: RSS feeds and ampersands in titles
Yes, my fix targets the built in RSS feed.
Offline
Pages: 1