I\'m using Smarty to pass in and display the contents of a first_name
variable. Some users have Emoji characters (http://en.wikipedia.org/wiki/Emoji) in their
Q: Can this be done with Smarty? A: Yes.
Q: Can it be done with PHP in Smarty? A: Yes. But please don't use PHP tags on template side.
Try to use a variable modifier on a template variable instead.
{* apply modifier to a variable *}
{$first_name|emojistrip}
Put the following content into a file named "modifier.emojistrip.php" in the folder "/smarty/plugins/".
function smarty_modifier_emojistrip($string)
{
return preg_replace('/\xEE[\x80-\xBF][\x80-\xBF]|\xEF[\x81-\x83][\x80-\xBF]/', '', $string);
}