toc_collapse=[1/0] in output
BBC - September 18, 2009 - 19:58
| Project: | Table of Contents |
| Version: | 6.x-3.1 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
After an upgrade to 6.x-3.1, I found that "toc_collapse=0" was appearing just before each of the TOC's on my site.
The culprit seems to be line 643 of tableofcontents.pages.inc:
$js = 'toc_collapse=' . ($toc->collapsed ? 1 : 0) . ';';
Not sure exactly what the intent of this chunk is supposed to be, but I found that commenting out this line entirely resolved the issue and haven't noticed any adverse affects as a result.

#1
Do you mean this line?
$js = '<script type="text/javascript">toc_collapse=' . ($toc->collapsed ? 1 : 0) . ';</script>';
The script tag should make the toc_collapse a script and execute it. But if you somehow don't have the tag at all, then it would appear as is in the text. Since Drupal issues system doesn't handle < and > characters as expected by most, it is hard to tell whether it was a little mistake or not. (although, you may want to use <?php and ?> to put code in issues.)
The only thing I could think of is that there is a problem in your theme...
Thank you.
Alexis
#2
Okay! I know 8-)
Go to your Input filters and make sure that the Table of contents filter is after the HTML Filter which would indeed remove the Javascript code for your own personal safety!
Thank you.
Alexis
#3
Thanks Alexis. Yes, the line you cite is the one I meant. (apologies for the code markup error)
You are correct that the problem was with the order of the input filters. I had moved HTML Corrector to follow Table of contents per the instructions in the readme, but didn't realize that there was also an interaction with HTML Filter here.
It would be helpful to include this in the installation instructions on the Table of Contents module home page and in the readme file.
Thanks again!
#4
Done.
Thank you for the feedback! 8-)
Alexis
#5
Automatically closed -- issue fixed for 2 weeks with no activity.