June 15th, 2011
I wanted a nice and simple way to offer a quick tweet button on each article in the same style and positioning as the email/print/pdf icons, which gives a very smart look, especially to section/category lists or blog articles.
I’m not sure how relevant being able to open up articles as pdf files is to most joomla installations, it certainly isn’t to any I have done, so I thought I’d re-use and re-hash the pdf code, the code responsible for supplying the icon and link to the pdf file, and adapt that to make a very neat twitter icon with dynamic title link.
First thing was to actually edit the typography.png file, which you will find in various places in a joomla installation. But if your template has one (most do), that is the one to edit. Open it up in photoshop or similar and carefully cut the pdf icon and replace it with the icon you want, in this case the standard blue twitter t icon.
I used photoshop guidelines to ensure positioning was correct, as the icon css is very precise. Just make sure that the new icon fits in the same space as the old PDF one.
Next I needed to edit the icon.php file which is located in the html/com_content folder of your theme.
The relevant section begins:
function pdf($article, $params, $access, $attribs = array())
I basically commented out the original pdf function and added a new one: