We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37840
    • 33 Posts
    Hey guys, I think I should post here since im just a n00b....its a quick one:

    When you using galleries, is there a way I can call from all the images in the gallery and sort by "date added" i cant see the option in the property "sort", i want something like this;


    [[!Gallery? &album=`1,2,3,4,5` &sort=`date_created` &dir=`desc` &limit=`3`]]



    So grab 3 images from all albums sorted by date created descending.

    Does this make sense, please help. I want to add a "Latest Photos" section

    -------------
    Also very quick how can I grab the full url of the page, i use
     [[!++site_url]][[*alias]] 
    but that doesnt grab the full url when variables are passed in the url

    [ed. note: bazpaul last edited this post 14 years, 7 months ago.]
      • 37840
      • 33 Posts
      It is taking me a long time to get an answer form these forums. This isnt the first time I have asked this question.

      Can anyone help. I would think this is very easy to answer.
        • 37840
        • 33 Posts
        Can anyone answer this??
          • 37840
          • 33 Posts
          Can anyone answer this??
            • 37339
            • 10 Posts
            Hey, bazpaul.

            The placeholder you want to call is "createdon" for the Gallery items. So it would look something like this:

            [[!Gallery? &album=`1,2,3,4,5` &sort=`createdon` &dir=`DESC` &limit=`3`]]


            Took me a while to find this myself, actually. For more options to sort by, look at the Default Placeholders (and possibly Properties, though I haven't tried) here:
            http://rtfm.modx.com/display/ADDON/Gallery.GalleryItem

            And when you asked for the full URL, did you mean for the image itself, or for the page that they are displayed on?
              • 37840
              • 33 Posts
              Wow thanks man, yeh I will try that. I think I tried that before, but i'll try again.

              I gave up on trying to figure it outa long time ago and went for something different.

              Lets say I wanted to show three random photos - would I use the same by write
                &sort=`rand`
              instead?

              ------

              For the full URL: I want to know how to capture the full URL of the page to code into a facebook like button. The page URL depends on which Gallery has been selected.

              http://www.antsinmyspacebar.com/modx/barry-oneill-photography.html?galAlbum=12

              You'll see that the like button displayed on each photo page is actually the same, rather than having a like button for each gallery!!
                • 37339
                • 10 Posts
                First and foremost, antsinmyspacebar is the greatest URL ever. Now that that's out of the way, I haven't used random sorting with Gallery before, but if it's anything like sorting the album covers, you would use:

                &sort=`random`


                rather than just "rand"... though, again, I haven't tested this.

                As far as the like buttons, are your galleries each separate resources in your MODx? If so, I believe you should be able to use this for the code so that each button corresponds to the page it's on:

                <div class="fb-like" data-href="[[~[[*id]]]]" data-send="true" data-width="450" data-show-faces="true"></div>


                The *id part will work if you are using this code in a template. If, however, you have the like button in a Chunk, then change it to a plus instead of an asterisk, like this:

                <div class="fb-like" data-href="[[~[[+id]]]]" data-send="true" data-width="450" data-show-faces="true"></div>


                I am not too familiar with the FB like buttons, but hopefully this will help!
                  • 24007
                  • 38 Posts
                  Hi,

                  Realise this thread was a while back, was just wondering where to find the attributes applicable to the 'sort' property relating to the gallery.

                  Looked in the modx gallery guide but could not see a list.

                  E.g

                  &sort=`createdon`
                  &sort=`ice_cream`
                  &sort=`cantfindlist`

                  Thanks