Themeing output from Send to Friend
Last updated on
30 April 2025
- go to your theme folder
- add the following function to your template.php
<?php /*Templating for Send Module*/ function YOURTHEME_send_body($values) { # send module can email multiple nodes, but my implementation sends only one.. # so this hopefully not break anything, node_load function will grab all other details for the # node that the user is emailing $node_details = node_load($values['nids']['0']); ## Adding my site banner $body = '<hr /><img src="http://example.com/logo.gif" /><br />'; ## adding node title $body .= '<h2><a href="http://example.com/'.$node_details->path.'">'.$node_details->title.'</a></h2><br/>'; ## adding full body, you might change this to only teaser $body .= $node_details->body; $template .= $values['template']; if ($values['message']) { $message = '<div class="messages">'.check_markup($values['message']).'</div>'; } $replace = array('%message', '%body'); $values = array($message, $body); return str_replace($replace, $values, $template); } ?> - For testing, I used the following code. Its helpful when you have complicated CCK fields and want to debug your code. If you use gmail , use the "show original text" to see the actual values of the array.
<?php /*Templating for Send Module*/ function YOURTHEME_send_body($values) { $node_details = node_load($values['nids']['0']); ## just dump everything into email body $body = print_r($node_details,TRUE); $template .= $values['template']; if ($values['message']) { $message = '<div class="messages">'.check_markup($values['message']).'</div>'; } $replace = array('%message', '%body'); $values = array($message, $body); return str_replace($replace, $values, $template); } ?>
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion