SuperGeekery Tagstripper Update - Dealing with HTML Special Characters

The Expression Engine add-on I wrote when I made SuperGeekery, SuperGeekery Tag Stripper, has had a small feature update.

I've spoken to a few people who have been using the plug in for creating the meta data for their header tags. I think they've basically been taking a field from their content, maybe the summary field or the body field, and placing it in the header so search engines get an accurate view of what the page is about. The Tag Stripper would leave them with clean text, without HTML tags.

This seemed to work well from what I've been told, except in the case where there was a lone quote. That quote had the possibility of closing the meta tag before it was supposed to. For example, if you were wanted to put A foot is 12" long. in your meta tags, the double quote mark after 12 would close the quotes you have in your HTML.

I've updated the SuperGeekery Tag Stripper, now at version 1.0.2, to address this issue. There is a new option, escapeHTMLchars. If you include this in any of the Tag Stripper functions, it will encode HTML special characters to their HTML entity equivalents. Specifically, the ampersand, double quote, single quote, less than, and greater than characters become & , " , ' , < , and > when this option is on.

BEFORE EXAMPLE:

{exp:tagstripper:stripAllTags escapeHTMLchars='true'}

A foot is 12" long.

{/exp:tagstripper:stripAllTags}

AFTER EXAMPLE:

A foot is 12" long.

I've also added support for NSM Addon Updater. In the future, you will see in your Expression Engine control panel if the addon has been updated. If you're not using it already, get it here. It is a free addon.

Download the updated version of SuperGeekery Tag Stripper from it's home page.

Comments on this post.

Great plugin. Could it be updated to decode html entities, as well?

By Nat on May 05 2011

Nat,

So you’d want it to accept a less than symbol, <, and output a “& lt ;”, basically baking in the html_entity_decode() PHP function?

-John

By John Morton on May 05 2011

I’d want it to accept ?& lt ;? and output <, but yes, just like html_entity_decode. I’ve got a template where I’m using html_entity_decode now, but I’d prefer not to have to enable php just for that.

By Nat on May 05 2011

Leave Your Comment:

name:

email:

location:

url:

your comment:

Remember my personal information

Notify me of follow-up comments?

Twitter Feed

John Morton talking on Twitter




Meanwhile on Instagram… //

My latest shot from Instagram.