How to Change the “Email this link to a friend” Template in Joomla

We are currently finalizing the migration of a very large Joomla website at the moment (from 1.5 to 2.5). During the latest QA session, we discovered that the “Email this link to a friend” popup page (the page that pops up when you click on the email icon on any article) does not look properly formatted. In this post, we will be explaining how to modify the template for this popup window!

As most Joomla developers know, every single layout of any component in Joomla is overridable – which means that creating a file, giving it a certain name and placing it in the right place will replace the layout of any page in Joomla. So, which file controls the layout of the “Email this link to a friend” popup page?

Well, that file is called default.php and is located under the /components/com_mailto/views/mailto/tmpl directory. So, in order to override the layout of that file, all you need to do is to copy that default.php file to the /templates/[your_template_name]/html/com_mailto/mailto directory (in most cases, that directory may not exist, so you will need to create it). Once you do that, you will be able to modify the look & feel of the “Email this link to a friend” popup by just editing that file (the default.php file).

But what about style changes?

CSS styles for the “Email this link to a friend” popup are controlled by the print.css file which is located under the /templates/[you_template_name]/css directory.

And how about the confirmation message?

Unfortunately, the confirmation message (the message that appears after you press the Send button) is not controlled by the same view that controls the layout of the form. It is controlled by another view, which is the sent view. So, if you would like to modify the confirmation message page, then all you need to do is to copy the default.php file from /components/com_mailto/views/sent/tmpl to the /templates/[your_template_name]/html/com_mailto/sent folder (again, you will need to create that directory if it doesn’t exist) and make your changes to the copied file.

Is that it?

Yes – that’s it! And the best thing is, you don’t need to touch any Joomla core file, which means that you can safely apply all Joomla updates without any fear that they may break your website!

Are there any caveats

There is one: Since you’re not changing the core (which is the right way to go) and you’re applying the layout changes for that popup only to a particular template, you will lose all the changes when you switch to a different template. However, copying the above directories to the new template will usually solve the problem (if the modified code is well written).

Now, if you need help changing the “E-mail this link to a friend” template, then all you need to do is to contact us and we’ll do it for you in no time! Our prices are very affordable, our work is professional, we are nice people to work with, and we really love Joomla!

No comments yet.

Leave a comment