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

    I have problem to order thumbs by specified way on the index page. My sitetree looks like that:

    X - container (index) - all thumbs at every subcontainer (= 1 thumb at every gallery), ordered by theme
    x - container - Theme A (1 thumb at every childgallery)
    o - gallery 1
    o - gallery ...
    o - gallery 15
    x - container - Theme ...
    x - container - Theme F

    Every container contains 3-20 galleries and shows a thumbnail at every childgallery.

    My goal: sometimes I need to reorder themes on the indexpage, so ordering by every gallery menu index would be very unhandy and easier is to order them by parent menu index.

    I have gathered all those thumbs at containers to the indexpage by call:

    <div class="img">[[MaxiGallery? &childgalleries_ids=`all` &display=`childgalleries` &childgalleries_order_by=`parent` &pics_per_page=`1`&pics_per_row=`5` &childgalleryTpl=`galeriiTpl`]]</div>


    The problem is that parameter &childgalleries_order_by=`parent` orders them by parent ID. I need it to be by parent menuindex or some other parent dok field.
    Where can I change that?

    If there is a better way to achieve my goal, please describe it exact as you can, as I am making a very first steps with MODx and MG.

    Thanks!
    Holger
      • 7923
      • 4,213 Posts
      You can use the GetField snippet to get the menuindex from the parent for the maxigallery orderby parameter.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 12288
        • 12 Posts
        Thank you for a hint but as I said, I’m not very familiar with coding, so would you, please, be more specific and tell, how should I use that?

        After reading a support topic http://modxcms.com/forums/index.php/topic,5643.0.html, all I figured out was next:

        <div class="img">[[MaxiGallery? &childgalleries_ids=`all` &display=`childgalleries` &childgalleries_order_by=`[!GetField? &docid=`[*parent*]` &field=`menuindex`!]` &pics_per_page=`1`&pics_per_row=`5` &childgalleryTpl=`galeriiTpl`]]</div>


        But this is as good as there was no ordering at all. Is the place wrong where I use that or is wrong the way I use that code?
          • 7923
          • 4,213 Posts
          Have you tried just by using:

          [!MaxiGallery? &childgalleries_ids=`all` &display=`childgalleries` &childgalleries_order_by=`menuindex` &pics_per_page=`1`&pics_per_row=`5` &childgalleryTpl=`galeriiTpl`!]


          So maxigallery orders the galleries simply by menuindexes.. Then set the menu indexes like so:

          X - container (index) - [the above call here]
          x - container - Theme A [menuindex 100]
          o - gallery 1 [menuindex 101]
          o - gallery ... [menuindex 102...114]
          o - gallery 15 [menuindex 115]
          x - container - Theme ... [menuindex 200]
          x - container - Theme F [menuindex 300]

          So when maxigallery sorts all the gallery documents by their menuindexes, they should be in the same order as in the site tree.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 12288
            • 12 Posts
            Yes, I thought about that, but this would be quite inconvenient if I need to reorder thumbs on the index page. Even if I want to move 1 theme (thumbnail group by theme), I would have to change menuindexes of all its galleries. That’s why I’m looking for a chance to order them by some field of their parents.
              • 7923
              • 4,213 Posts
              Well its quite hard to do with maxigallery as it gets all galleries in to an array and sorts them flat. So it cannot keep the tree form of the actual documents.

              It’s easier to just list the gallery documents Wayfinder for example as it respects the menu indexes and tree structure. Then just call maxigallery in wayfinder templates to get the thumbnails from the gallery documents.


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 12288
                • 12 Posts
                Thanks!
                I haven’t had a time to try it yet as I need to find some examples. But there is one more question came up: as thumbs are ordered by parent ID on the index page at the moment, where is that ordering determined? Can I change it to use menuindex (parents of course) instead of ID?
                  • 7923
                  • 4,213 Posts
                  The &childgalleries_order_by parameter is used to set the order, like you have done.


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 12288
                    • 12 Posts
                    No, I mean that now, after using parameter &childgalleries_order_by=`parent`, all "parents" are ordered by their ID-s. And then I thought that somewhere in the code have to be it determined. My question was: where is that place and is it possible to change that?
                    In other words: what and where determines now the order of "parents"?
                      • 7923
                      • 4,213 Posts
                      Yes, and like I have said, it should be done by listing the gallery documents with wayfinder. Read maxigallery wiki page about the &childgalleries_order_by parameter and you know how it works.

                      This thread is going in circles...


                        "He can have a lollipop any time he wants to. That's what it means to be a programmer."