Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MaxLazar/be966c0a9586036d3f82 to your computer and use it in GitHub Desktop.
Save MaxLazar/be966c0a9586036d3f82 to your computer and use it in GitHub Desktop.
prep no_results tag for ee
private function _prep_no_results() {
$td =& ee()->TMPL->tagdata;
$open = 'if mx_no_results';
$close = '/if';
if ( strpos( $td, $open ) !== FALSE && preg_match( '#'.LD.$open.RD.'(.*?)'.LD.$close.RD.'#s', $td, $match ) ) {
if ( stristr( $match[1], LD.'if' ) ) {
$match[0] = ee()->functions->full_tag( $match[0], $td, LD.'if', LD.'\/if'.RD );
}
ee()->TMPL->no_results = substr( $match[0], strlen( LD.$open.RD ), -strlen( LD.$close.RD ) );
$td = str_replace( $match[0], '', $td );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment