We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2327
    • 214 Posts
    Hello,

    I have a problem with the plugin Page TOC Generator (http://www.modxcms.com/Page-TOC-Generator-1274.html) charged to generate a synopsis of the doc content, based from the <h> html title tag.

    This plugin does not seem run with the 0.9.6.1 Rev 3118 Modxversion ( the last stable). All the plugin Tags (<!--#toc_plugin#.....-->) are not interpreted by Modx and leaves like simple tag comment HTML. The detail of the problem and the example are describe in this post: http://modxcms.com/forums/index.php/topic,11162.msg127114.html#msg127114

    Could somebody test this plugin on this last stable version of Modx ?

    I do not know if the problem comes from a incompatiblity of this plugin with the 0.9.6.1 version or with specific version of php. Mine is 5.2.1 PHP version.

    If you have a few minutes to make the test on the 0.9.6.1 MODx version, and say if that goes on your installation, thank you very much for your help.
    kiss kiss kiss
      • 10449
      • 956 Posts
      Just installed it and created a test page; works a treat: http://www.screenlab.ch/pageTOC-plugin-test.html
      MODx 0.9.6 rev 2767
      PHP Version 5.2.0
      mySQL 4.1.15

      Gonna try it on a 0.9.6.1 install in a couple of minutes...
        • 10449
        • 956 Posts
        Working just as well with 0.9.6.1 (latest stable), PHP Version 5.1.6, mySQL 5.0.24a (XAMPP)
          • 2327
          • 214 Posts
          Thank you very much, ganeshXL !

          Can you copy/Past the exact source code you used in this perfect sample ? Probably it’s me which cannot correctly used this plugin ? smiley
            • 10449
            • 956 Posts
            It’s the exact same sample code provided by the plugin author.
              • 2327
              • 214 Posts
              Thank you ganeshXL!

              I do not absolutely understand from where this problem can come… >:( >:(

              5.2.1 PHP version ?

              You have only activated the OnWebPagePrerender in the installation of the plugin ? Anything else in the field of the configuration ?

              Thank you at all events to have reacted so quickly smiley
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                PHP 5.2.4, MODx 0.9.6.1 rev 3013
                http://www.sottwell.com/article-weblinks.html
                Also exact same installation/configuration as in the plugin comments

                It says the configuration section is optional, but without it all I get are some visible div tags.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I did notice, however, that this uses ereg_replace for the final replacements of the strings into the documentOutput. The PHP documentations says that str_replace should always be used intstead of ereg_replace if there are no regular expressions involved. This is just straight-up string replacement, so it should be using str_replace there at the end.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 2327
                    • 214 Posts
                    Thanka you very match, sottwell !

                    I am not sure to understand the subtlety of your answer about this order of instructions.

                    But I have make a copy of the plugin code from your manager ant it’s work perfectly now smiley smiley smiley smiley.


                    Thank very very much !
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      $source = ereg_replace("<!--#toc_plugin#_TOC_OUTPUT-->", $display_content, $source);
                      $source = ereg_replace("<!--#toc_plugin#_START_CONFIGURATION-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_list_type=".$setting1."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_start_level=".$setting2."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_end_level=".$setting3."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_header=".$setting4."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_header_tag=".$setting5."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_parent_tag=".$setting6."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_parent_tag_id=".$setting7."-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_END_CONFIGURATION-->", "", $source);
                      $source = ereg_replace("<!--#toc_plugin#_START_TOC_INDEXING-->", " ", $source);
                      $source = ereg_replace("<!--#toc_plugin#_END_TOC_INDEXING-->", " ", $source);

                      should be
                      $source = str_replace("<!--#toc_plugin#_TOC_OUTPUT-->", $display_content, $source);
                      $source = str_replace("<!--#toc_plugin#_START_CONFIGURATION-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_list_type=".$setting1."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_start_level=".$setting2."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_end_level=".$setting3."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_header=".$setting4."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_header_tag=".$setting5."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_parent_tag=".$setting6."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_parent_tag_id=".$setting7."-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_END_CONFIGURATION-->", "", $source);
                      $source = str_replace("<!--#toc_plugin#_START_TOC_INDEXING-->", " ", $source);
                      $source = str_replace("<!--#toc_plugin#_END_TOC_INDEXING-->", " ", $source);
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org