TagifyThis
Inspired by a post on dive into mark, TagifyThis is a little function I wrote a while ago, that surrounds specified strings with specified tags and attributes.
The first use I made of it was for acronyms, but it can be used for just any tag.
You give it a string, and a list of lines like "literal" tag attribute "value", and then whenever it sees literal in the string it converts it to <tag attribute="value">literal<tag>.
When I first blogged about it, it was broken because of a bug in PHP’s handling of PREG_SET_ORDER, and because it could only handle one list of strings and tags. It just wasn’t flexible. Now PHP is fixed, and TagifyThis handles any list of replacements that you throw at it.
More documentation in the source: tagifythis.phps.
2 responses
Looks good to me: useful, and nicely done.
Which is a good thing, since with that relative link triggering whatever it is that causes your server to tack on a PHP session id when wget, curl, or Bloglines comes calling for your feed, I’ll be seeing this post as unread every single time Bloglines refreshes until it falls off the bottom of your feed :(
#1 Phil Ringnalda — 2004/03/14 at 7:02
You must have
session.use_trans_sidon in php.ini. If you have it on for a reason, like you need it somewhere,php_value session.use_trans_sid 0in .htaccess in the directory where your feeds are generated ought to stop it slapping on the session id for things that don’t accept cookies.
#2 Phil Ringnalda — 2004/03/24 at 5:25
Your words