MODx Revolution: Formatting Strings using PHx

I have just unearthed some small MODx treasures call PHx. PHx (Placeholders Xtended) will add the capability of output modifiers when using placeholders, content tags (including template variables) and settings tags. The recursive parser allows for nested tags. Custom modifiers can be added by creating "mini-snippets" in the MODx resource manager.

Lowercase:

[+string:lcase+]

Uppercase:

[+string:ucase+]

First character as uppercase:

[+string:ucfirst+]

Length of the current value:

[+string:len+]

Strip html tags:

[+string:notags+]

Escapes html and the bracket characters:

[+string:esc+]

Convert the input to html entities:

[+string:htmlent+]

Strip newlines (\n), tabs (\t) and multiple spaces:

[+string:strip+]

Reverse the current value:

[+string:reverse+]

Breaks words in the current value longer than the given length of characters by putting a space in between (default: 70 characters):

[+string:wordwrap=`10`+]

MD5 hash from the current value:

[+string:md5+]

Even more documented here: http://wiki.modxcms.com/index.php/PHx

About Keiron

Web Developer based in the UK. Click here if you want to work with me