Daydream Lab
Subscribe to the Daydream Lab [RSS]

“Early Christians transformed the world by thinking different and living different, not by complaining about everybody else’s morals.”

—Alan Wilson

“‘You are destroying yourself,’ he cried. ‘You have the inclination to be alone and to dream and you are afraid of dreams. You want to be like others in town here. You hear them talk and you try to imitate them.’”

—Sherwood Anderson

“On earth we are wayfarers, always on the go. This means that we have to keep on moving forward. Therefore be always unhappy about what you are if you want to reach what you are not.”

—St. Augustine

“In the third month they began to pile up the heaps, and finished them in the seventh month.”

—2 Chronicles 31:7 (ESV)

“There would so much less laughter in the world if evil people stopped talking.”

—MadPriest

“Then I commended mirth, because a man hath no better thing under the sun, than to eat, and to drink, and to be merry…”

—Ecclesiastes 8:15

“Did they teach you how to question when you were at the school? Did the factory help you grow? were you the maker or the tool?”

—Ewan MacColl

“Happiness happens when you are not thinking about it, when you are inhabiting your body comfortably…when you feel at peace with yourself and the world. When we live overprotective, overstimulated lives we expect more all the time, we find it hard to be unself-conscious and just do what we do; we overanalyse.”

—Rowan Williams

“You can never win a war against terror as long as there are conditions in the world that make people desperate—poverty, disease, ignorance, et cetera….I think people are beginning to realize that you can’t have pockets of prosperity in one part of the world and huge deserts of poverty and deprivation and think that you can have a stable and secure world.”

—Desmond Tutu

“The distrust of wit is the beginning of tyranny.”

—Edward Abbey
Contact Me

Elsewhere in my Brain

Archive by category

Archive by date

Custom RSS in Textpattern

Part Two: Escaping special characters

In this article, I’ll just be fixing a minor annoyance left at the end of Part 1.

I recommend reading Part One first, or at least copy the page and forms we’ll be modifying here.

Part of what I’m doing will use atb_rss_tags. This ridiculously-simple plugin simply makes three of PHP’s string-manipulation functions available as Texpattern tags: strip_tags(), htmlspecialchars(), and trim().

Here I use <txp:htmlspecialchars> to fix one irritation from last time: the validation error which occurs when a special character, such as “&” appears in a title, site motto, etc.

Last time, I did this in my RSS page:

<description><![CDATA[<txp:site_slogan />]]></description>

Which is probably fine. But using htmlspecialchars is more in line with what Textpattern does with its standard RSS feed:

<description><txp:atb_html_special_chars><txp:site_slogan /></txp:atb_html_special_chars></description>

Which turns, for example, “@&@” into “@&@”, generating correct XML. It might also be a good idea to use this on your article form, in the title tag, in case you use any forbidden characters in your article titles:

<title><txp:atb_html_special_chars><txp:title /><txp:atb_html_special_chars></title>

Field Reports:

Commenting is closed for this article.