Skip to content

Instantly share code, notes, and snippets.

@LinuxDoku
Created January 29, 2012 21:34
Show Gist options
  • Save LinuxDoku/1700816 to your computer and use it in GitHub Desktop.
Save LinuxDoku/1700816 to your computer and use it in GitHub Desktop.
/**
* This will display tplMods please use the smarty function in order to get the best results!
* @param string $position name of the position
* @return bool
*/
public function displayTplModification($position, $surroundDiv) {
$return = true;
if (!isset($this->_tplModificationCache[$position])){
return $return;
}
foreach ($this->_tplModificationCache[$position] as $func) {
if ($func[4] == false){
continue;
}
if ($func[2]) {
if ($func[3]){
$this->loadPackage($func[3], false, false);
}
include_once($func[2]);
}
$pack = $this->loadPackage(preg_replace("/^package_/", "", $func[0]), false, false);
if (!Package::$perm->checkPerm($pack, $func[1], $func[0])) {
continue;
}
ob_start();
echo '<div'.$surroundDiv.'>';
$bCallFunction = call_user_func_array(array($func[0], '__tpl_' . $func[1]), array());
echo '</div>';
$sHtml = ob_get_contents();
ob_end_clean();
$hookCache = Package::$packages->callHook('displayTplModification', array($sHtml, $position, $pack, $func));
$sHtml = ($hookCache === true)?$sHtml:$hookCache;
echo $sHtml;
if (!$bCallFunction){
$return = false;
}
}
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment