Skip to content

Instantly share code, notes, and snippets.

@johndwells
Created July 22, 2011 13:34
Show Gist options
  • Save johndwells/1099465 to your computer and use it in GitHub Desktop.
Save johndwells/1099465 to your computer and use it in GitHub Desktop.
A clever way to succinctly normalise a parameter passed to EE
// Found within the guts of Stash: https://github.com/croxton/Stash
// set default value in 2nd param passed to TMPL::fetch_param()
$my_param = (bool) preg_match('/1|on|yes|y/i', $this->EE->TMPL->fetch_param('my_param', 'yes'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment