public function get_count($sql)
 {
     $result = $this->get_value($sql);
     PerchUtil::debug_badge((string) $result);
     return intval($result);
 }
 public function render($content_vars, $index_in_group = false)
 {
     $system_vars = PerchSystem::get_vars();
     if (is_object($content_vars)) {
         $ids = $this->find_all_tag_ids($this->namespace);
         $content_vars = $content_vars->to_array($ids);
     }
     if (is_array($system_vars) && is_array($content_vars)) {
         $content_vars = array_merge($system_vars, $content_vars);
     }
     if (!is_array($content_vars)) {
         $content_vars = array();
     }
     if ($index_in_group === false && !count($content_vars)) {
         PerchUtil::debug_badge('0');
     }
     $template = str_replace(PERCH_PATH, '', $this->template);
     $path = $this->file;
     $contents = $this->load();
     // API HANDLERS
     $contents = $this->render_template_handlers($content_vars, $contents);
     // BLOCKS
     $contents = $this->parse_blocks($contents, $content_vars);
     // SINGLE BLOCK
     $contents = $this->render_block($contents, $content_vars);
     // REPEATERS
     $contents = $this->parse_repeaters($contents, $content_vars);
     // RELATED
     $contents = $this->parse_related($contents, $content_vars);
     // CATEGORIES
     $contents = $this->parse_categories($contents, $content_vars);
     // FORMS
     if ($template) {
         $contents = str_replace('<perch:form ', '<perch:form template="' . $template . '" ', $contents);
     }
     // BEFORE
     $contents = $this->parse_paired_tags('before', true, $contents, $content_vars, $index_in_group, 'parse_conditional');
     // AFTER
     $contents = $this->parse_paired_tags('after', true, $contents, $content_vars, $index_in_group, 'parse_conditional');
     // IF
     $contents = $this->parse_paired_tags('if', false, $contents, $content_vars, $index_in_group, 'parse_conditional');
     // EVERY
     $contents = $this->parse_paired_tags('every', false, $contents, $content_vars, $index_in_group, 'parse_every');
     // CONTENT
     $contents = $this->replace_content_tags($this->namespace, $content_vars, $contents);
     // SHOW ALL
     $contents = $this->process_show_all($content_vars, $contents);
     // HELP
     $contents = $this->remove_help($contents);
     // NO RESULTS
     $contents = $this->remove_noresults($contents);
     // RUNWAY
     $contents = $this->remove_runway_tags($contents);
     // UNMATCHED TAGS
     $contents = $this->remove_unmatched_tags($contents);
     return $contents;
 }