The code used for Icy Phoenix is much more complex, because template system uses cache.
Anyway you can do something like this (taken from my plugins code) to assign a path:
/*
* Get template file: check if template file exists and set the correct path to template file
*/
function get_tpl_file($tpl_base_path, $tpl_file)
{
global $theme;
$tpl_path = $tpl_base_path . 'default/' . $tpl_file;
$tpl_temp_file = $tpl_base_path . $theme['template_name'] . '/' . $tpl_file;
if (@file_exists($tpl_temp_file))
{
$tpl_path = $tpl_temp_file;
}
return $tpl_path;
}