Comment

Tech Note: Improvements to LGF Pages

202
Charles Johnson7/14/2011 6:06:34 pm PDT

re: #182 Charles

This is actually a handy little bit of PHP code — it goes through an arbitrary string of text, finds HTML tags, and puts quotes around any unquoted attributes those tags contain.

It’s a little tricky to encode the whole process in one regular expression, so I use a ‘while’ loop to do each unquoted attribute in turn. Not the most efficient way to do it, but for LGF comments that are limited in length it works just dandy.