We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10076
    • 1,024 Posts
    Hi I' ve got a site where ditto and codaslider are used to make a slider that is created by adding child documents to the parent defined in the ditto call. I am trying to transfer this to a revo site with get resources, but things dont workout. Would love to get some tips.

    so in the evo header there s this:

    <script type="text/javascript">
    $().ready(function() {
           $('#coda-slider-[*id*]').codaSlider({
               autoSlide: true,
               autoSlideInterval: 30000,
               dynamicArrows:1,
               dynamicTabs: 0,
    autoHeight:0
           });
       });
    </script>


    the chunk with the dittocall is:

    <div class="coda-slider-wrapper">
           <div id="coda-nav-[*id*]" class="coda-nav">
    <div class="coda-slider preload" id="coda-slider-[*id*]">
    [!Ditto? &parents=`[*newsBoxes*]`  &tpl=`newsHeader` &debug=`0`!]
    </div>
    </div>
    </div>
    


    I thought i d change all the [*id] to
    [[+id]]
    , and the tv s to the correct tv s, but not much happens, actually nothing happens. Any mistakes that stand out here?

      • 27022
      • 47 Posts
      im just a modx rookie, but dont you need to change your snippet call to start and end with the double brackets? And after the parents, the tv should be
      [[*newsBoxes]]
      .

      Also, i dont think there needs to be an exclamation point at the end of your snippet call. Mainly, your tags need to be updated to revo tags:

      <script type="text/javascript">
      $().ready(function() {
             $('#coda-slider-[[*id]]').codaSlider({
                 autoSlide: true,
                 autoSlideInterval: 30000,
                 dynamicArrows:1,
                 dynamicTabs: 0,
      autoHeight:0
             });
         });
      </script>


      <div class="coda-slider-wrapper">
             <div id="coda-nav-[[*id]]" class="coda-nav">
      <div class="coda-slider preload" id="coda-slider-[[*id]]">
      [[!getResources? &parents=`[[*newsBoxes]]`  &tpl=`newsHeader`]]
      </div>
      </div>
      </div>
      


      I'm not sure that you can use the ID like that in your jquery call, but i dont really know. This would be my uneducated stab at it using getResources instead of ditto

      [ed. note: shick11sp last edited this post 14 years, 8 months ago.]
        • 10076
        • 1,024 Posts
        I did change that before posting, here the codes I am using, now in the source the
        [[+id]]
        in the header does not get a value?

        The header script:
        <script type="text/javascript">
        $().ready(function() {
               $('#coda-slider-[[+id]]').codaSlider({
                   autoSlide: true,
                   autoSlideInterval: 30000,
                   dynamicArrows:1,
                   dynamicTabs: 0,
        autoHeight:0
               });
           });
        </script>

        The ne getResources call
        <div class="coda-slider-wrapper">
               <div id="coda-nav-[[+id]]" class="coda-nav">
        <div class="coda-slider preload" id="coda-slider-[[+id]]"><a style="display:none">[[+id]]</a>
        [[!getResources? &parents=`[[+id]]`&includeContent=`1` &tpl=`myRowTpl`]]
        </div>
        </div>
        </div>
          • 27022
          • 47 Posts
          http://www.markhamstra.com/modx-blog/2010/07/getting-started-with-getresources-for-a-blog/

          based on this post by mark, i'd say that in the snippet call, the parents property needs to be *id, not +id. Maybe that is what is preventing the +id in the head from showing properly
            • 3749
            • 24,544 Posts
            Maybe I'm misundertanding what you're doing, but I don't see how that could have worked in Evo. The tag in the JS would never be converted to the ID of the page retrieved by Ditto since Ditto is not processing the template, just the Tpl chunk. The same would be true in Revo with getResources.

            I suspect that all the tags, both in the Tpl chunk and the JS were replaced with the ID of the current doc. That may work, although it's incorrect to have multiple ID values with the same setting. If that's the case, you don't need any tags at all for the slider, they could all be

            id="coda-slider"


            It might work (and be more correct) to use this, depending on how the coda-slider is written:

            class="coda-slider"


            and in the JS:

            $('.coda-slider').codaSlider({




            ---------------------------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
            MODx info for everyone: http://bobsguides.com/MODx.html
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 10076
              • 1,024 Posts
              Bobray thanks,

              The evo site is still running. I have another site build with the same ditto and coda slider combination. And have a tut somewhere https://forums.modx.com/index.php?action=dlattach;topic=47875.0;attach=11572 unfortunately most attachments have disappeared from the forum. If needed can provide all. Anyway both sites ( evo and revo) run on the latest versions.
                • 10076
                • 1,024 Posts
                @shick11sp the *id bit in the header gives a value to the codaslider script. Thanks a start.
                Now the rest...
                  • 10076
                  • 1,024 Posts
                  Hi,

                  got it working with one problem, I am using the MODx boilerplate "framework" and the site_footer chunk has a jquery call that disables the coda slider. It s this part

                  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
                  <script>window.jQuery || document.write('<script src="[[++site_url]]assets/modx-boilerplate/main/js/libs/jquery-1.7.1.min.js"><\/script>')</script>
                  
                  <script defer src="assets/js/plugins.js"></script>
                  <script defer src="assets/js/scripts.js"></script>


                  I need a solution for that and will post a small tutorial as soon as that is fixed.



                    • 30912
                    • 463 Posts
                    have you tried calling it using noConflict, I usually find that when using jquery sliders on our sites they conflict with each other due to the $ being shared through instances of jquery libraries.
                      • 15739
                      • 3 Posts
                      franklos,

                      Were you able to get the coda slider working in revo finally? If so, could you please explain how you did it? Thanks.