We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7391
    • 49 Posts
    Awesome! Works great!

    Leif: If you've install the plugin correctly then if you go to "Elements>Manage Elements" and view any element (template, chunk, snippet, etc).. you should see it highlighted with codemirror instead of just plain black text.

    Hope this helps! smiley
      • 16903
      • 39 Posts
      That's strange!
      I installed the Plugin without an error. But there is no highlighting... :-(

      MODX Version: Evo 1.0.6
      CodeMirror: 2.25

      Any idea how to solve that problem?
        • 19369
        • 1,098 Posts
        You could have the wrong path (it happened to me). Open the source code and see if the path for codemirror is correct, or inspect the page with firebug.
          • 15001
          • 697 Posts
          My experience with CodeMirror

          1. The context

          In the past, I have been using in MODx Evolution the plugins for the EditArea and GeSHi text highlighting editors.

          EditArea is easy to install on Evo.
          I appreciated its search feature.
          One reason I stopped using EditArea was it slowered the rendering of the ressources in the manager.

          Two reasons lead me giving a try to CodeMirror:
          First, I was looking for some plugin having code folding feature, like Firefox DOM editor does have: http://codemirror.net/demo/folding.html
          Second, I hoped that CodeMirror would be faster to load/render than EditArea, and the good new is that it is.

          2. The installation

          I encountered several quirks during installation on Evo 1.0.15 running on PHP 5.6.15 but got it working at the end.

          First I downloaded the plugin from its repository on GitHub:
          https://github.com/hansek/MODX-Evolution-CodeMirror

          After opening the archive, I copied the content of codemirror folder in assets/plugins to the matching location in Evo.

          Copied the "install" folder at the root of my website and run the installer.

          The installer was able to create the plugin and set the event handlers.
          However it displayed some error related to the DBAPI.
          The fact is that the installer is still using mysql_connect, which is obsolete with PHP >= 5.5.
          (mysqli_connect should be used instead)

          After installation, Evo's manager login screen was no longer working and displaying some error related to the obsolete mysql_connect function.

          So, I edited "manager/includes/config.inc.php" to force MODx using mysqli:
          $database_type = 'mysqli';


          This restored the access to the manager.

          However, the CodeMirror code highlighter was still not working because the "cm" subfolder in assets/plugins/codemirror was empty.

          I downloaded the archive of CodeMirror 2.25 from the top message in this thread, which does have a non-empty "cm" folder: https://forums.modx.com/attachment/download?file=8114

          I dragged and dropped its content in assets/plugins/codemirror/cm.

          CodeMirror now highlights contents correctly (including the template variables used in YAMS) and is fast.

          3. Bug / Not working

          I observe that if the content is higher than the textarea, the lift/elevator is stuck at the top of that area.
          I tried replacing the content of the "cm" folder with the latest (5.34.0) version of CodeMirror but this had no effect.

          4. Additional notes
          The folding feature is inactive with the default configuration.
          There is no "search" feature with the default configuration.
            • 2762
            • 1,198 Posts
            Maybe i did not understand your issue, but why have you installed CodeMirror on Evo 1.0.15?
            Evo 1.0.15 is two years old, but if I remember correctly, CodeMirror was already included in Evo.

            I think is better move to a more recent Evo version (with php5.5 and msqli support) and an updated codemirror.
              Free MODx Graphic resources and Templates www.tattoocms.it
              -----------------------------------------------------

              MODx IT  www.modx.it
              -----------------------------------------------------

              bubuna.com - Web & Multimedia Design