Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
"TOC" does not work when older document is displayed
jsarzik #1
Member since Aug 2019 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: tpl_toc(true)
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?

 * 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; ?>
    <?php endif; ?>
    <div class="layout-col_item layout-col_item--max layout-col_item--detail">
        <?php tpl_content(false); ?>
andi (Administrator) #2
User title: splitbrain
Member since May 2006 · 3541 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
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.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
This post was edited on 2019-08-02, 14:02 by andi.
jsarzik #3
Member since Aug 2019 · 2 posts
Group memberships: Members
Show profile · Link to this post
Yes, moving the call to tpl_content () before tpl_toc () works.

Thank you.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-08, 17:50:13 (UTC +02:00)