SOLVED!! Bug in Multiple Print feature when using {maketoc}

posts: 69

Reference my previous posting about using {TOC} for Books >Chapters >Sections (first three layers of this wiki) and {MAKETOC} for the Subsections, Subsubs, Subsubsubs and Subsubsubsub (H3-H6).

My users require off-line access to this document, and to accomplish this I suggest using the Multiple Print feature. Multi-Print allows them to save the subsequent page as a .HTM file (which they can open in Word or a browser) or "print" the page with a PDF print driver from Adobe, cuteFTP, or SourceForge.

Multiple Print works properly until it encounters a {MAKETOC} statement in the document, at which time it prints the TOC listing followed by the MAKETOC listing. There is no {TOC} statement on that page in the structure, so I have no explanation for why Multi-Print would insert the TOC information while displaying the MAKETOC listing.

Has anyone else encountered this problem? Any suggestions?


NOTE: Cannot reply to the last post on this item (bug in 4.0?) so am appending to the original posting:


I have uploaded the tikilib.php file with my changes to the bug report URL you indicated. My fix is well commented with "//=====" and begins about line 7150 of the file.

Hope this helps you!


posts: 69

I solved the two problems related to MAKETOC, specifically in Option'print', MAKETOC would improperly display the Print button; and MAKETOC duplicated TOC postings in Multiple Print operations. The corrections involve 8 lines of code in >Function "parse_data_process_maketoc" of tikilib.php.

I am new here and don't know quite what to do with my findings, but if there are any other users for whom this is an important issue please feel free to contact me, I'd be happy to explain how to fix MAKETOC for better Table of Contents operation in large books.


posts: 1817 Catalan Countries

Hi Larry and welcome to Tikiwiki Community! smile

Yes, please, request commit access and fix that bug in the subversion branch (trunk, if the bug is still there, and proposed, to be included in the next tiki 3.x release, whenever this happens).

More information through:

And thanks in advanced for improving the multiprint (I didn't hit this bug, yet, but I would have definitively touched it in a few months with my students... so thats for finding and fixing)


posts: 69

Thank you for your suggestion regarding commit access, but I lack SSH access to my ISP's server. For those who need it, I have uploaded my changes to the File Gallery in the TikiWIki files directory.

The changes can be applied to either tikiwiki v3.1 or v3.2:

Locate the file \lib\tikilib.php.
Open tikilib.php with PSPad, Wordfile, or some other editor (not Notepad).
Tikilib.php is a large file and contains many PHP functions. The following code REPLACES the code in function parse_data_process_maketoc.
All of the code changes I made to the function are characterized by the expression //=====
Although I only made a few changes, I thought it might be easier for folks to copy/paste the entire function rather than try and identify the changes individually.


posts: 4

What lines of code need to be swapped? I can not find where you posted them. I believe that this will also fix a problem we are seeing with Search where the results look the same due to the TOC being appended. Can you please post you line changes here or attach them as a file to the bug you opened http://dev.tikiwiki.org/tiki-view_tracker_item.php?itemId=2781

Best regards,

posts: 4
I am still seeing the "MAKETOC duplicated TOC postings in Multiple Print operations" that you described above and the duplication of TOC in search results. This is causing some major confusion with our clients....
posts: 69
The changes that I made to my local copy of likilib.php were not incorporated by the developers in v4.0. After upgrading, I had to manually edit the new version and retrofit those changes to get TOC and MAKETOC to work together.