{
foreach ($var[2] as $tmpcnt => $tag)
{
$fulltag = $tag;
if ($delim = strpos($tag, ' > '))
{
$tag = substr($tag, 0, $delim);
}
if (strpos($tag, ','))
{
list($tag, $addparam) = explode(',', $tag, 2);
}
$extension = $var[1][$tmpcnt];
if (substr($tag, 0, 4) == 'top.')
{
$title = $this->tip($vars[substr($tag, 4)]);
}
elseif ($lvl_block[$i] == 0)
{
$title = $this->tip($vars[$tag]);
}
else
{
$title = '[BLOCK?]';
}
$code = '<b title="' . $title . '">{' . $extension . ':' . $fulltag . '}</b>';
$rows[$i] = str_replace('{'.$extension . ':' . $fulltag .'}', $code, $rows[$i]);
}
}
// 'IF nnn' Blocks
if (preg_match_all('/<!-- IF ([a-zA-Z0-9_.]+) -->/', $rows[$i], $var))
{
foreach ($var[1] as $tag)
{
if (substr($tag, 0, 4) == 'top.')
{
$title = $this->tip($vars[substr($tag, 4)]);
}
elseif ($lvl_block[$i] == 0)
{
$title = $this->tip($vars[$tag]);
}
else
{
$title = '[BLOCK?]';
}
$code = '<span title="' . $title . '"><!-- IF ' . $tag . ' --></span>';
$rows[$i] = str_replace("<!-- IF $tag -->", $code, $rows[$i]);
if ($title == '[NULL]')
{
$rows[$i] = str_replace('Hide', 'Show', $rows[$i]);
$rows[$i] = str_replace('block', 'none', $rows[$i]);
}
}
}
}
$page = join("<br>", $rows);
// Print Header
echo '<html><head><script type="text/javascript">
function toggleVisibility(el, src) {
var v = el.style.display == "block";
var str = src.inner
HTML;
el.style.display = v ? "none" : "block";
src.innerHTML = v ? str.replace(/Hide/, "Show") : str.replace(/Show/, "Hide");}
</script></head><body>';
// Print Index
echo '<font face="Arial" Size="3"><b>';
echo 'SmartTemplate Debugger<br>';
echo '<font size="2"><li>
PHP-Script: ' . $_SERVER['SCRIPT_FILENAME'] . '</li><li>Template: ' . $this->filename . '</li></font><hr>';
echo '<li><a href="#template_code">Template</a></li>';
echo '<li><a href="#compiled_code">Compiled Template</a></li>';
echo '<li><a href="#data_code">Data</a></li>';
echo '</b></font><hr>';
// Print Template
echo '<a name="template_code"><br><font face="Arial" Size="3"><b>Template:</b> [<a href="javascript:void(\'\');" onclick="toggleVisibility(document.getElementById(\'Template\'), this); return false">Hide Ouptut</a>]</font><br>';
echo '<table border="0" cellpadding="4" c