I've created a couple of node--[type|nodeid].tpl.php files & they are working like I want them to.

I have some reusable code between them -- how do I get them to share? I assume a different .tpl.php, but I'm not sure how to get both access to it.

For example I'd like the following to be at the bottom of a few different nodes, how can I make sure they can all reference this?

<div class="contact_header">Address</div>  
<div class='contact_link'><?php print $address_link ?></div></h3> 
<div class='ss_normal'>Address to go here. </div>
</div>

Comments

Function in template.php

Hi, One way would be to create a function in your theme's template.php file. In template.php you could add something like:

function custom_node_output($address_link, $address) {
  $otuput = '<div class="contact_header">Address</div> <div class="contact_link">' . $address_link  . '</div> <div class="ss_normal">' . $address . '</div>';
  return $output;
}

Then in your node template files, where you wanted the output to appear you could add something like:

<?php
$address
= 'whatever the address is';
print
custom_node_output($address_link, $address);
?>

Hope that helps

Ed