public function fetch($widget, &$smarty) { $file = __CFG::DIR . "plugins/widgets/" . $widget['widget'] . '/widget.php'; if (!$widget['method']) { $widget['method'] = 'index'; } $wdt = K::W($widget['widget']); $wdt->smarty =& $smarty; if (!method_exists($wdt, $widget['method'])) { $widget['act'] = $widget['method']; $widget['method'] = 'index'; } if (!($data = $wdt->{$widget}['method']($widget))) { return ''; } $smarty->assign('data', $data); $widget['GUID'] = K::GUID('widget'); $smarty->assign('widget', $widget); if (!$widget['tpl']) { $widget['tpl'] = 'widget:/default/default.html'; } if (strpos($widget['tpl'], ':') === false && strpos($widget['tpl'], '/') === false) { $tmpl = "widget:{$widget['widget']}/{$widget['tpl']}"; } else { $tmpl = $widget['tpl']; } return $smarty->fetch($tmpl); }