How to print a variable set in my custom module's inc file in node-contenttype.tpl.php I am trying to grab all links under id="ctl00_ctl00_MainPlaceHolder_MainPlaceHolder_TaobaoLink".

Here is the function used in my custom module file:

function _taobao_add_tovar($url){
  $url = str_replace('&amp;amp;','&amp;',$url);
  $tovar_page = _taobao_get_page('http://rutaobao.com/pages/item_detail.aspx?ItemId='.urldecode($url));

  $linkz = _taobao_get_block($tovar_page, '"ctl00_ctl00_MainPlaceHolder_MainPlaceHolder_TaobaoLink" title="Открыть оригинальную страницу этого товара на taobao.com"&gt;');
  preg_match_all('%&lt;a [^&gt;]+href="(?P&lt;url&gt;[^"]+)"[^&gt;*]*&gt;(?P&lt;text&gt;[^&lt; ]+)&lt;/a&gt;%si', $tovar_page, $linkz);
}


I've set the $linkz variable. How can I print it in node-mycontenttype.tpl.php?
To get a variable to a custom node.tpl.php you need to do this in MODULE_preprocess_node(&amp;$variables) usually this is done in your template.php file located inside your themes directory, however, because you are calling a private function _taobao_get_page(), I think you need it inside your module.

Something like

MODULE_preprocess_node(&amp;$variables) {
   if ($node-&gt;type == 'mycontenttype') {
      $variables['linkz'] = X;
   }
}


Now you can call $linkz inside your tpl.php file