autoload([ 'dcTemplator' => __DIR__ . '/inc/class.templator.php', 'pagerTemplator' => __DIR__ . '/inc/admin.pager.templator.php', ]); dcCore::app()->templator = new dcTemplator(); dcCore::app()->addBehavior('initWidgets', ['templatorWidgets', 'initWidgets']); class templatorWidgets { public static function initWidgets($w) { $w->create('templatorWidget', __('Templator › Rendering'), ['widgetTemplator', 'getDataTpl']); $tpl = ['      .html' => '']; foreach (dcCore::app()->templator->tpl as $k => $v) { if (preg_match('/^widget-(.+)$/', $k)) { $tpl = array_merge($tpl, [$k => $k]); } } $w->templatorWidget->setting('template', __('Template:'), '', 'combo', $tpl); } } class widgetTemplator { public static function getDataTpl($w) { if (dcCore::app()->tpl->getFilePath($w->template)) { echo dcCore::app()->tpl->getData($w->template); } } }