Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created November 4, 2012 22:08
Show Gist options
  • Select an option

  • Save objectivehtml/4013982 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/4013982 to your computer and use it in GitHub Desktop.
public function delegate()
{
$delegate = $this->tag_part(2);
$method = $this->tag_part(3);
$this->EE->TMPL->tagparts[1] = $delegate;
$this->EE->TMPL->tagparts[2] = $method;
return $this->run($delegate);
}
function tag_part($part, $default = FALSE, $boolean = FALSE)
{
if(!isset($this->EE->TMPL->tagparts[(int)$part]))
{
$this->show_error('This \''.$part.'\' is not a valid tagpart.');
}
$part = $this->EE->TMPL->tagparts[$part];
if($part === FALSE && $default !== FALSE)
{
$part = $default;
}
else
{
if($boolean)
{
$part = strtolower($part);
$part = ($part == 'true' || $part == 'yes') ? TRUE : FALSE;
}
}
return $part;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment