public static function getTemplate($tag, $produce_error=true)
        {
//          get the template
            $template_name = isset($tag['attributes']['template']) === true ? $tag['attributes']['template'] : 'default';
            if(is_array(CustomTags::$tag_directory_base) === false)
            {
                CustomTags::$tag_directory_base = array(CustomTags::$tag_directory_base);
            }
            foreach (CustomTags::$tag_directory_base as $directory)
            {
                $template = rtrim($directory, DIRECTORY_SEPARATOR).$tag['name'].DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$template_name.'.html';
                if(is_file($template) === true)
                {
                    return file_get_contents($template);
                }
            }
//          template doesn't exist so produce error if required
            if($produce_error === true)
            {
                CustomTags::throwError($tag['name'], 'tag template resource not found.');
            }
            return false;
        }