Permalink
Browse files

Fixing stupid bug

  • Loading branch information...
1 parent ba2f48d commit 7d6a82c076b02f6033f20b6ce38629ce91f178d6 @litzinger committed Dec 9, 2011
Showing with 12 additions and 7 deletions.
  1. +12 −7 ft.template_snippet_select.php
@@ -186,9 +186,9 @@ function display_var_field($data)
function replace_tag($data, $params = '', $tagdata = '')
{
// If it's numeric, then we have a Snippet ID, otherwise we have a template
- if(is_numeric($data) and $data and ($snippet = isset($this->EE->config->_global_vars[$this->_get_snippet($data)])))
+ if(is_numeric($data) and $data and isset($this->EE->config->_global_vars[$this->_get_snippet($data)]))
{
- return $snippet;
+ return $this->EE->config->_global_vars[$this->_get_snippet($data)];
}
elseif($data)
{
@@ -367,12 +367,17 @@ private function _get_templates()
private function _get_snippet($snippet_id)
{
- $this->EE->db->select('snippet_name');
- $this->EE->db->where('snippet_id', $snippet_id);
- $this->EE->db->from('snippets');
- $query = $this->EE->db->get();
+ if(!isset($this->cache['snippet_'. $snippet_id]))
+ {
+ $this->EE->db->select('snippet_name');
+ $this->EE->db->where('snippet_id', $snippet_id);
+ $this->EE->db->from('snippets');
+ $query = $this->EE->db->get();
+
+ $this->cache['snippet_'. $snippet_id] = $query->row('snippet_name');
+ }
- return $query->row('snippet_name');
+ return $this->cache['snippet_'. $snippet_id];
}
private function _get_snippets()

0 comments on commit 7d6a82c

Please sign in to comment.