modifier for hiding emails from spam-bots
| From: | Patrick Fehr | Date: | Tue, 01 Mar 2005 22:44:18 +0000 |
| Subject: | modifier for hiding emails from spam-bots | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12282@lists.php.net to get a copy of this message | ||
Hi all
Again a little contribution from my side, maybe that already exists but I
think it's useful anyway :)
function smarty_modifier_no_spam ($email)
{
$the_at = strpos($email, '@'); //position of the @
$part1 = substr($email, 0, $the_at+1); // all to and with @
$part2 = substr($email, $the_at+1); //all right from @
$no_spam_mail = $part1."<span
style=\"display:none\">nospam</span>"
$part2;
return $no_spam_mail;
}
use it with your smarty object like that:
smarty_obj->register_modifier("no_spam", "smarty_modifier_no_spam");
and in the template:
{$my_email|no_spam}
have fun
patrick
--
Patrick Fehr
Swiss Federal Institute Of Technology