In my node.tpl.php file I have this custom code:
<?php if($node->field_division['und'][0]['value'] = 1):
$cta = $GLOBALS['base_url'].'/node/6';
elseif($node->field_division['und'][0]['value'] = 2):
$cta = $GLOBALS['base_url'].'/node/7';
endif;
?>
I want to move it to my template.php file, so I can access it both from node.tpl.php and page.tpl.php.
How can I do this?
I tried following the examples in this thread and this article but I can't get it to work. Any help would be greatly appreciated.