We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7923
    • 4,213 Posts
    Good stuff.. I’ll make a not to my self to fix it.

    BTW, have you checked the query examples in maxigallery wiki page?

    You can get a random picture like this from galleries under document id 38

    [!MaxiGallery? &gal_query_ids=`38` &query_level_limit=`999` &order_by=`random` &limit=`1`!]

    Then you could do a custom galleryPictureTpl that links to the gallery document from the picture by adding &galleryPictureTpl=`mgGalleryPictureChunk` to the snippet call and doing a chunk named "mgGalleryPictureChunk" that has something like this:
    <a href="[~[+maxigallery.picture.gal_id+]~]">
    	<img src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" title="Click to open the gallery" alt="[+maxigallery.picture.title:htmlent+]" />
    </a>
    <p>[!GetField? &docid=`[+maxigallery.picture.gal_id+]` &field=`pagetitle` !]</p>
    

    For the gallery document pagetitle I used in the above example the GetField snippet.

    Then also create a custom &galleryOuterTpl=`mgGalleryOuterChunk` with just this in it:
    [+maxigallery.pictures+]
    

    That placeholder returns the content of galleryPictureTpl.

    The difference in this and the childgalleries view that you implemented is, that this gets a random picture from all the galleries, so with bad luck, you could get some gallery more than the others if some have more pictures than others.. but of course the picture selection is random, so you’ll never know, but the odds are better for the single large gallery.. With random childgalleries display it first get’s a random childgallery document and then selects a picture from it, so it doesn’t matter if some gallery is bigger than some other, it’s the same odds for all the galleries. You can btw use the &order_by parameter in childgalleries display mode call too in addition to the &childgalleries_order_by to define if you want a random picture from the random gallery or first or with &offset added some specific picture, etc. See also the Childgalleries examples.


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