Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created September 21, 2012 14:48
Show Gist options
  • Save objectivehtml/3761912 to your computer and use it in GitHub Desktop.
Save objectivehtml/3761912 to your computer and use it in GitHub Desktop.
Manipulate the no_results tag
// Add this to your module tag
if($no_results_prefix = $this->EE->TMPL->fetch_param('no_results_prefix'))
{
if(preg_match('/\\'.LD.'if '.$no_results_prefix.'no_results\\'.RD.'.*\\'.LD.'\\/if\\'.RD.'/us', $this->EE->TMPL->tagdata, $matches))
{
$this->EE->TMPL->no_results = $this->EE->TMPL->parse_variables_row($matches[0], array(
$no_results_prefix.'no_results' => 1
));
}
}
// Usage in EE template
{exp:parent:tag}
{if no_results}
<p>No Parent Results</p>
{/if}
{exp:child:tag no_results_prefix="nested_"}
{if nested_no_results}
<p>No Child Results</p>
{/if}
{/exp:child:tag}
{/exp:parent:tag}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment