Created
September 21, 2012 14:48
-
-
Save objectivehtml/3761912 to your computer and use it in GitHub Desktop.
Manipulate the no_results tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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