Stringer is useful for manipulating text/strings in different ways and allows you to access and modify strings using PHP while not enabling PHP in templates.
1) Striptags - Remove all HTML tag from your content
There are several parameters you can use to control how the content is truncated.
These options are:
chars_start = “” // Start char to limit number of character chars = “” // Limit by number of characters words = “” // Limit by number of words cutoff = “” // Limit by a specific cutoff string append = “” // String to append to the end of the excerpt allow_tags = “” // HTML tags you want to allow
{exp:stringer:striptags allow_tags="<p>|<em>|<strong>"}
{your_content}
{/exp:stringer:striptags}
{exp:stringer:striptags allow_tags="<a>|<blockquote>|<p>" append="..." words="50"}
{your_content}
{/exp:stringer:striptags}
{exp:stringer:striptags allow_tags="<a>" cutoff="<!-- More -->" append="..."}
{your_content}
{/exp:stringer:striptags}
{exp:stringer:striptags allow_tags="<p>" chars_start="10" chars="50" append="..."}
{your_content}
{/exp:stringer:striptags}
2) Tags - Allow All HTML tag but Remove particular HTML tags from your content.
There is one parameters for remove particular tags.
remove_tags = “” // HTML tag you want to remove
{exp:stringer:tags remove_tags="<a>|<blockquote>|<p>"}
{your_content}
{/exp:stringer:tags}
3) Stringer provides the following useful text manipulations as well
{exp:stringer:uppercase}this string is uppercase.{/exp:stringer:uppercase}
{exp:stringer:lowercase}THIS STRING IS LOWERCASE{/exp:stringer:lowercase}
{exp:stringer:uppercasefirst}this string first character upppercase{/exp:stringer:uppercasefirst}
{exp:stringer:charlength}number of characters in a string.{/exp:stringer:charlength}
{exp:stringer:wordlength}string total words length{/exp:stringer:wordlength}
{exp:stringer:find_replace find="text|and" replace="string|or"}Multiple text find and replace{/exp:stringer:find_replace}
{exp:stringer:find_replace find="|" replace="/"}slash|replace|{/exp:stringer:find_replace}
{exp:stringer:numberformat decimals="2" dec_point="." thousands_sep=","}1234567890{/exp:stringer:numberformat}
{exp:stringer:trim side="left"} string trimming! {/exp:stringer:trim}
- side[left,right,both]
{exp:stringer:slug separator="-" case="lower"}Generate Slug{/exp:stringer:slug}
- case [=lower, upper, nochange]
{exp:stringer:wordwrap width="5" break="<br>" cut="true"}This is wordwarp string{/exp:stringer:wordwrap}
{exp:stringer:hash algo="encode"}This is an encoded string'{/exp:stringer:hash} - base64 encode
{exp:stringer:hash algo="decode"}VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZyc={/exp:stringer:hash} - base64 decode
{exp:stringer:hash algo="md5"}password{/exp:stringer:hash}
- algo [="decode","encode","md2", "md4", "md5", "sha1", "sha224", "sha256", "sha384",<br> "sha512", "ripemd128", "ripemd160", "ripemd256", "ripemd320", "whirlpool", <br>"tiger128,3", "tiger160,3", "tiger192,3", "tiger128,4", "tiger160,4", "tiger192,4",<br> "snefru", "snefru256", "gost", "gost-crypto", "adler32", "crc32", "crc32b", <br>"fnv132", "fnv1a32", "fnv164", "fnv1a64", "joaat", "haval128,3", "haval160,3", <br>"haval192,3", "haval224,3", "haval256,3", "haval128,4", "haval160,4", "haval192,4", "<br>haval224,4", "haval256,4", "haval128,5", "haval160,5", "haval192,5", "haval224,5", "haval256,5"]
Explode splits a given string by a given separator
{exp:stringer:explode separator="," string="93 Old Pacific Dr, Pembroke Pines, FL,33028"}
Street: {string1}<br>
City: {string2}<br>
State: {string3}<br>
Zip : {string4}
{/exp:stringer:explode}
- Example Output:
Street: 93 Old Pacific Dr
City: Pembroke Pines
State: FL
Zip : 33028
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.