[pmwiki-users] figuring out table of contents location

John Rankin john.rankin at affinity.co.nz
Sat Jul 28 21:33:40 CDT 2012

Try this test: put (:toc-hide:) into one of the pages (ie not in the
GroupHeader) and see if the page toc appears in the side bar. Explanation

> On Sun, Jul 22, 2012 at 2:22 AM, John Rankin <john.rankin at affinity.co.nz>
> wrote:
>>> What I want is for the table of contents for the page to appear in the
>>> side bar rather than in the wikitext area. The only one I could manage
>>> to make do this is HandyToc, but it has the disadvantage (for me) of
>>> requiring javascript.
>>> I tried using the remote toc facility of pagetoc, but it didn't work
>>> as I'd hoped.
>>> With pagetoc.php, I tried putting (:toc-hide:) in the GroupHeader, and
>>> (:toc-page {*$FullName} self=1:) in Site.PageToc. No love.
>> So what happens, exactly?
> Sorry, been caught up with other things (younger daughter's wedding...

> In Site.GroupHeader, I have the following:
> (:description {*$:Summary}:)(:toc-hide:)

I think this may be the source of the mis-feature. Could you do an
experiment for me?

Could you try putting (:toc-hide:) into one of the pages, rather than in
the GroupHeader?

The source of the problem, I think, is this code in pgetoc:

function RemoteTableOfContents($pagename,$ref,$self=0) {
    global $TocHeaderFmt,$RemoteTocFmt;
    $oTocHeader = $TocHeaderFmt;
    $TocHeaderFmt = str_replace('$Toc',$ref,$RemoteTocFmt);
    $tocname = MakePageName($pagename,$ref);
    if ($tocname==$pagename && $self==0) return '';
        $toc = str_replace('[[#',"[[$ref#",
    $TocHeaderFmt = $oTocHeader;
    return $toc;

This code only returns a "remote" table of contents if the body of the
target page contains a (:toc-hide:) or similar directive. If the suggested
test generates a working toc in the side bar, we will need to modify the
above code to retrieve the GroupHeader text and add it to the start of the
retrieved page's text.

Fortunately, this will be a trivial change. However, the side-effect will
be that (:toc-page PageName:) will then generate a remote page toc for
pages with no headings.

John Rankin

More information about the pmwiki-users mailing list