Difference between revisions of "How to cloak email addresses"
From Joomla! Documentation
m (Added Category:Plugins. Also removed 1.6 and 1.7 versions and added 3.x)
|Line 37:||Line 37:|
Revision as of 17:31, 29 April 2013
Joomla has inbuilt email cloaking functionality that can be called within a component or module template, through the JHtml Class. To call this cloaking routine in your component, use the following syntax:
echo JHtml::_('email.cloak', 'email@example.com');
Which will display firstname.lastname@example.org
If you want to not have a mailto link, and just have an email address displayed that is not a hyper link, use the following syntax:
echo JHtml::_('email.cloak', 'email@example.com', 0);
This will simply display firstname.lastname@example.org.
If you would like to have a different email address displayed from the one that is actually linked to, you use the following syntax:
echo JHtml::_('email.cloak', 'email@example.com', 1, 'firstname.lastname@example.org');
And if you would like a different phrase other than an email address displayed as a mailto hyper-link, use this syntax:
echo JHtml::_('email.cloak', 'email@example.com', 1, 'click here to email me', 0);