Hi,
I am trying to override the default way that the print.module outputs its 'printer friendly version' link. Although I felt pretty familiar with theming, I am for some reason unable to get this to work right... Can someone please let me know what I am doing wrong...?
The module itself generates the following code:
<?php
function theme_print_link($node) {
$links = l(t('printer friendly version'), "node/$node->nid/print", array('title' => t('Display a printer friendly version of this page.')));
return $links;
}
?>
So i figured, this can be overridden using template.php, so added this to my template.php file, assuming that my theme is called mythemename
<?php
function mythemename_item_list($items = array(), $node) {
return _phptemplate_callback('print_link', array('items' => $node));
}
?>
So then i made a file called print_link.tpl.php in which i placed the below. the print_friendly DIV has red background in my style-sheet just for testing purposes.
<div class="print_friendly">
<?php print $links; ?>
</div>
For some reason I thought this was going to work but it doesn't seem to be generating any output... Am I missing something totally obvious here ?
Thanks
- Jochen
Comments
sorry about the errors
Actually in the above it should be
and then the print_link.tpl.php should print out the $node variable, not $links...
-------
http://quilted.org
http://jochenhartmann.com
you can just copy the entire function....
into your template.php file and customize it there.
like this:
Craig.
having the same fun problem again for some reason
this is all on a site that is on 4.6.5, i swear to god i thought i really understood this, and have actually implemented it where everything worked... but for some strange reason, no such luck here...
assuming i want to overwrite the separator between the $links (normally a pipe character => | )
so i get the theme function from theme.inc
and then i throw that into template.php with a minor change (mythemename being the name of my theme)
and voila, it doesnt work...
any ideas ?
thanks!!!!!
- jochen
-------
http://quilted.org
http://jochenhartmann.com