We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19180
    • 21 Posts
    Is there a way to put the whole Ditto call in a Div without doing it through a template?
    I have a div with with styling around my ditto call but I need the whole div to vanish when there’s no content. The easiest way I thought to do this is to include the div within the ditto code so that when there is no content ditto won’t display anything including the container div.

    Is there anyway to include this div around the whole ditto call?
      • 1122
      • 209 Posts
      The following is a Javascript trick:
      <div id="someUniqueID" class="...">
          [[Ditto? ... &noResults=`doHide` ... ]]
      </div>
      

      Content of the "doHide" chunk:
      <script type="text/javascript">
          var objDiv = document.getElementById('someUniqueID');
          objDiv.style.display = 'none';
      </script>
      

      If Ditto fetches no document, the content of "doHide" chunk will be outputted hiding the whole div.
        • 4172
        • 5,888 Posts
        see also this extender : http://modxcms.com/forums/index.php/topic,27177.msg200836.html#msg200836
        or jakos phx-modifier
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!