/**
  *
  */
 public static function parse($ps_template, $pa_options = null)
 {
     $vs_cache_key = md5($ps_template);
     if (isset(DisplayTemplateParser::$template_cache[$vs_cache_key])) {
         return DisplayTemplateParser::$template_cache[$vs_cache_key];
     }
     $ps_template_original = $ps_template;
     // Parse template
     $o_doc = str_get_dom($ps_template);
     $ps_template = str_replace("<~root~>", "", str_replace("</~root~>", "", $o_doc->html()));
     // replace template with parsed version; this allows us to do text find/replace later
     $va_tags = DisplayTemplateParser::_getTags($o_doc->children, array_merge($pa_options, ['maxLevels' => 1]));
     if (!is_array(DisplayTemplateParser::$template_cache)) {
         DisplayTemplateParser::$template_cache = [];
     }
     return DisplayTemplateParser::$template_cache[$vs_cache_key] = ['original_template' => $ps_template_original, 'template' => $ps_template, 'tags' => $va_tags, 'tree' => $o_doc];
 }