jsarzik
I've modified my template below. TOC is functional as long as I'm on the normal detail page. However, once I view an older version of the page, TOC is not working.
Why is it caused?
<?php
/**
* Template header, included in the main and detail files
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
global $EVENT_HANDLER, $ACT, $ID, $INFO, $lang, $conf;
$toc = tpl_toc(true);
?>
<div class="layout-col layout-col--2">
<?php if(!empty($toc)): ?>
<div class="layout-col_item layout-col_item--toc">
<?php echo $toc; ?>
</div>
<?php endif; ?>
<div class="layout-col_item layout-col_item--max layout-col_item--detail">
<?php tpl_content(false); ?>
</div>
</div>
andi
I might be wrong here (haven't looked at the code).
Usually the TOC is created as part of the XHTML render process, which is triggered by the tpl_content() call. When you call tpl_toc() before tpl_content(), the TOC is instead read from the saved meta data information. However this metadata only exists for the current page version.
Your problem might be solved by calling tpl_content() before tpl_toc(), but I'm not sure. Worth a try.