function smartyDebug() { if (!defined('Smarty::SMARTY_VERSION')) { return; } $c = Ethna_Controller::getInstance(); $debug_tpl = $c->getDirectory('template') . "/smarty_debug.tpl"; //if smarty2 //if (!file_exists($debug_tpl)) { // Ethna::raiseWarning(sprintf("Smarty debug template not found, please set %s.", $debug_tpl), E_USER_WARNING); // return null; //} require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_debug.php'; // get template directory $r = $c->getRenderer(); $smarty = $r->getEngine(); $vars = Smarty_Internal_Debug::get_debug_vars($smarty); //$smarty_original_debugging = $smarty->debugging; //$smarty_original_debugtpl = $smarty->debug_tpl; //$smarty->debugging = true; //$smarty->debug_tpl = $debug_tpl; //$smarty->assign('_smarty_debug_output', 'html'); echo '<div class="ethna-debug" id="ethna-debug-smartydebugwindow">'; echo '<div class="ethna-debug-title">SmartyDebug</div>'; echo '<div class="ethna-debug-subtitle">Smarty template vars</div>'; echo "<div class=\"ethna-debug-log\">"; foreach ($vars->tpl_vars as $k => $v) { $v = array($k => $v->value); self::dumpArray($v); } echo "</div> \n"; echo '<div class="ethna-debug-subtitle">Smarty config vars</div>'; echo "<div class=\"ethna-debug-log\">"; foreach ($vars->config_vars as $k => $v) { $v = array($k => $v->value); self::dumpArray($v); //self::dumpArray($v->value); } echo "</div> \n"; echo "</div> \n"; echo '</div>'; //$smarty->debugging = $smarty_original_debugging; //$smarty->debug_tpl = $smarty_original_debugtpl; }