Skip to content

Instantly share code, notes, and snippets.

@sjelfull
Forked from objectivehtml/gist:1478635
Created December 18, 2011 14:33
Show Gist options
  • Select an option

  • Save sjelfull/1493583 to your computer and use it in GitHub Desktop.

Select an option

Save sjelfull/1493583 to your computer and use it in GitHub Desktop.
A better way to fetch EE parameters
private function param($param, $default = FALSE, $boolean = FALSE, $required = FALSE)
{
if($required && !$param) show_error('You must define a "'.$param.'" parameter in the '.__CLASS__.' tag.');
$param = $this->EE->TMPL->fetch_param($param);
if($param === FALSE && $default !== FALSE)
{
$param = $default;
}
else
{
if($boolean)
{
$param = strtolower($param);
$param = ($param == 'true' || $param == 'yes') ? TRUE : FALSE;
}
}
return $param;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment