It would be nice to add the feature to display an icon instead of ''printer friendly version''.

Denis

Comments

Bevan’s picture

Did you find a way to do this?

JohnG-1’s picture

I thought this would be easy but it isn't !!! I tried :

<?php

function phptemplate_print_link($node) {
  return '<a href="node/' . $node->nid . '/print"><img src="files/print_icon.gif" alt="Display a printer friendly version of this page."></a>';
}

?>

but got a load of < / # < gobbledigook ... It looks like there's some drupal filter that prevents me just using old-fashioned HTML img src links ...

The print.module function that formats the 'Printer Friendly Version' link is:

<?php
/********************************************************************
 * Module Functions :: Themeable Functions
 ********************************************************************/

function theme_print_link($node) {
  return array('title' => t('Printer friendly version'),
           'href' => "node/$node->nid/print",
           'attributes' => array('title' => t('Display a printer friendly version of this page.')),
         );
}
?>

but it's not very themable !

Does anyone know what's going on ?

Bevan’s picture

What sort of gobbledygook did it spit out?

JohnG-1’s picture

OK the link title showed up as a < and the url was something like < / # < gobbledigook ... it has to be an input filter, no?

JohnG-1’s picture

I found a promising forum thread which - at a glance at least - provides plenty of tips: http://drupal.org/node/49393.

I don't have much time right now so if anyone has any luck with it, it would be great if you could post your solution here.

somebodysysop’s picture

Anyone got this working?

Bevan’s picture

I disabled link display in print settings, and manually put the printer friendly url in the theme. Works well.

JohnG-1’s picture

add this to your style.css - make sure the url ref is correct for your icon:

.print a {
    padding-left: 20px;
    background:url(icons/print.png)  no-repeat;
}

This will 'prefix' your icon into the link label eg '[X] Printer Friendly Version'.
The padding just makes room for the icon.

jcnventura’s picture

Status: Active » Fixed

The print link is now defined with it's own class: print-page. It should be possible to use this as suggested by JohnG to add your own icon. Try to use the following css:

.print-page {
background:url() no-repeat;
width:px;
height:px;
font-size: 0px;
}

I haven't tried it in IE, but it works well in Firefox.

jcnventura’s picture

Status: Fixed » Closed (fixed)
malet’s picture

Hello,
First of all thx for this module. But I'm a beginner in Drupal and i don't know where i'm supposed to change the code. I would like to have differents icons depending on where i am on the website. The icons can be red, blue, orange ...
I watch in the file print.modile the function theme_print_format_link but how can i retrieve the "context" (node or whatever)
Thx you for helping me and have a nice day ;)