I have a snippet of HTML that I've saved in my theme as mysnippet.inc. I'm using this code in template files (eg. node.tpl.php) to include it:
<?php include($directory."/includes/mysnippet.inc"); ?>
This is working fine, but the snippet also needs to access Drupal variable $node_url. So I tried to global it into my snippet:
<?php global $node_url ; ?>
<?php print $node_url; ?>
This doesn't work.
What would be the best way to achieve this? Should I be using template.php to create a variable containing my code snippet instead?