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

    visibily, in MODx 0.9.5 beta 3 (rev 1533), the new line is 898 ...

    But I don’t understant what to replace : it is said to change... so I’m awaiting changing X with Y as the new code is given.... I think it is the replacement code

    And I can’t figure it could work as the code - as i’ve read it- uses $content[’nocontent’] then it define it some lnes further...
    so visibely... thery is something I have not understand huh

    tx for your help
      • 6726
      • 7,075 Posts
      You have to replace

      <?php if ($content['type'] == "document" || $_REQUEST['a'] == 4) { ?>


      by

      <?php if(($content['type']=="document" || $_REQUEST['a']==4) && $content['nocontent'] != true ) { ?>


      It just means it adds a check to see if the document as an empty content field or not, which is the whole point of HideEditor, not showing the content field upon editing when it’s empty.

      But it doesn’t work anymore in the latest 0.9.5 betas, probably changes to the core code require an upgrade for this plugin...
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
        • 23478
        • 133 Posts
        thanks

        yes doing only that replacement can’t make the "plugin" work because $content[’nocontent’] isn’t define at all...
        the other code has to be paced somewhere... but as the core of modX hs been changed deeply.. I can’t find where to define $content[’nocontent’]

        well ... I will wait :’( until the modification will be included in modX 1 wink
          • 6726
          • 7,075 Posts
          piwaille, that’s not the reason... the plugin has the necessary code to check the ’nocontent’

           <?php
          
          if(strpos($template, '[*content*]') === false) {
                  /* Template doesn't use [*content*] */
                  $content['nocontent'] = true;
                  return;
                }
          
          ?>
          


          It’s somewhere else in the mutate_content.dynamic.php I guess....
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 21255
            • 215 Posts
            Here’s a new version of that plugin which works without hacking the core code wink
            (It’s tested with current beta only.)

            /**
             * @name Hide Editor
             * @author Timon Reinhard <[email protected]>
             * @license GNU General Public License
             * @version 0.3
             *
             * Hides editor if active template contains no content var
             * Listens to event 'OnDocFormRender'
             *
             */
            
            global $content;
            $e = & $modx->Event;
            
            if(($e->name=='OnDocFormRender') && ($content['template']>0)) {
              if(($template = $modx->db->getValue("SELECT content FROM {$modx->db->config['table_prefix']}site_templates WHERE id = {$content['template']}")) !== false) {
                if((strpos($template, '[*content*]')===false) && (strpos($template, '[*#content*]')===false)) {
                  $output = '<script type="text/javascript">';
                  $output.= 'document.getElementById(\'ta\').parentNode.parentNode.previousSibling.setAttribute(\'style\',\'display:none !important;\');';
                  $output.= 'document.getElementById(\'ta\').parentNode.parentNode.setAttribute(\'style\',\'display:none !important;\');';
                  $output.= '</script>';
                  $e->output($output);
                }
              }
            }
            
              • 6726
              • 7,075 Posts
              Thanks A LOT Timon for the upgrade, works like a charm grin (to those who upgrade, don’t forget to modify the event listener to OnDocFormRender instead of OnDocFormPreRender)

              I have gotten used to HideEditor so much I was at loss without it...
              This should be added to the resources page !

              I see you know have both [*content*] and [*#content*] covered, nice too !
              Kudos !!!
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l&#39;outil id
                • 21255
                • 215 Posts
                Thanks grin Did you test it with a release version?
                  • 6726
                  • 7,075 Posts
                  No, just with 0.9.5 beta rev1687.

                  I’ll try it with a 0.9.2.1 install when I get the chance, and report...
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 33337
                    • 3,975 Posts
                    Does anybody check this with IE ? tongue it seems its not compatible with IE.

                    rev1817

                    Update: some permissions problem, investigating further, will update here.

                    Update2: well, it doesnt work in IE. regardless the permission problem.

                    regards.

                    zi
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link
                      • 33337
                      • 3,975 Posts
                      IE problem confirmed in 095RC1! It does not hide the content area in IE 6.0 XPSP2.

                      regards.

                      zi
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link