We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27140
    • 7 Posts
    I’ve created a snippet which generates AJAX tabs from documents.

    Please take a look.

    This snippet is used here:
    http://coloris.com.ua/7speaking/index.php?id=51
    Unfortunately site isn’t in English.

    New version of tabControl is available!

      Regards,
      Vladimir Shugaev
      • 26931
      • 2,314 Posts
      hey Shugaev,

      thanks for sharing - i’ll try it later!
        • 26931
        • 2,314 Posts
        hi Shugaev,

        i tested it - working great! smiley see here: http://bit.ly/3tctqD ( loading content is very "snappy" ! )

        thanks for your contribution, jan

        to display resources that have "show in menu" not ticked off, i changed line 93 of class.tabControl.php to (it’s working, but is it the right way of doing it?):

        $docs=$modx->getDocumentChildren($parents, 1, 0, 'id, pagetitle', 'hidemenu=1', 'menuindex', 'ASC');
          • 26931
          • 2,314 Posts
          me again smiley

          i get some validation errors on the tab-links: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.kunane.com%2Fmodx%2Ftab-control.html&charset=%28detect+automatically%29&doctype=Inline&group=0

          any ideas on how to get rid of them?

          thanks, j
            • 25663 MODX Staff
            • 12,272 Posts
            Add to that the ability to modify the URL so each tab can be bookmarked and you’ve got a must-have add on for those wanting jQuery enhanced pages. Great work!
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 4310
              • 2,310 Posts
              @sharkbait
              Looks like you may just need to change the & to & in the tpl chunks or snippet if you’re using the default.
                • 26931
                • 2,314 Posts
                Looks like you may just need to change the & to & in the tpl chunks or snippet if you’re using the default.
                thanks bunk! smiley ...i knew it would be the &s - installed a plugin to replace all instances of them on prerender, but had no effect...didn’t think of looking into the snippet code...all valid now smiley
                  • 27140
                  • 7 Posts
                  Add to that the ability to modify the URL so each tab can be bookmarked and you’ve got a must-have add on for those wanting jQuery enhanced pages. Great work!
                  Thanks, a great idea!
                    Regards,
                    Vladimir Shugaev
                    • 20401
                    • 13 Posts
                    Hi

                    Looks like a handy snippet but I’m having trouble understanding the readme file and how to get it working.

                    Firstly, I’ve uploaded everything to "YOUR_MODX_ROOT/assets/snippets/tabControl/" and made a new snippet called "tabControl". Am I supposed to copy code into this snippet from one of the included php files?

                    Secondly, the readme gives the example below, a call to the snippet and some html - i dont understand how these two things go together, how the example relates to the snippet call, whether they all go on the same page? or is [+tabs+] calling [[tabControl? &parents=`parents` &tpl=`tpl`]]?? - - - can anyone please clarify?

                    -add [[tabControl? &parents=`parents` &tpl=`tpl`]] to your page...
                    -EXAMPLE:
                    <ul class="tabs">
                    [+tabs+]
                    </ul>
                    <div class="tabContent">
                    [+content+]
                    </div>

                    thanks for your help
                      • 3707
                      • 241 Posts
                      I haven’t used this snippet but I would guess you would paste the contents of snippet.tabControl.php into the snippet.
                      [[tabControl? &parents=`parents` &tpl=`tpl`]]
                      Is the call to the snippet you add to the page.
                      <ul class="tabs">
                      [+tabs+]
                      </ul>
                      <div class="tabContent">
                      [+content+]
                      </div>
                      Is an example of template code which goes in the chunk specified in the &tpl parameter.