We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8109
    • 128 Posts
    What I’d like is a page with the gallery images followed by all the gallery’s subdirectories (as thumbs or links), which may or may not have images in them. The idea is to have an easily navigable gallery structure for purposes of populating and editing the galleries. Here’s my current approach:

    1. On every gallery page I have a chunk called {{maxigalleryManagerCall}}, which looks like this:

    <H1>Gallery: [*pagetitle*]</H1><br /><p>Gallery ID: [*id*]. <a href="[~[*parent*]~]">Go up one level</a></p><br /><br /><H2>Gallery Pictures</H2><br />[!MaxiGallery? &display=`embedded`  &galleryOuterTpl=`GalleryOuterTplManger`!]<br /><!--&childgalleries_level_limit=`1`--><br /><br /><!--CHILD GALLERIES--><br /><BR CLEAR=ALL><HR><br /><br /><H2>Child Galleries</H2><br /><!--INVISIBLE DITTO CALL FOR COUNT FUNCTION-->[!Ditto? &save=`3` &id=`children` &depth=`1` &display=`all` !]<br /><p>There are [!dittoCount? &id=`children`!] directories below this gallery.</p><br /><br />[!Ditto? &depth=`1` &display=`all` &tpl=`childGalleryTplManager`  &orderBy=`menu_index ASC`  !]


    notice this gives you the gallery name and ID, the images, using a MaxiGallery call, and then a section for child galleries. I have discovered that you can’t simply display the child galleries if you want to display directories that do have a MaxiGallery call but which do not contain images.

    2. To display all subdirectories of the current gallery page, I have used a Ditto call. Actually, there are two. One is invisible and is used with a snippit to output the number of subdirectories. The second Ditto call retrieves the first-child subdirectories and returns each using the following template {{mgSubdirectories}}:

    <!--INVISIBLE DITTO CALL--> <br />[[Ditto? &parents=`[+id+]` &save=`3` &id=`children2` &depth=`1` &display=`all` ]]<br /><br /><p><a href="[~[+id+]~]">[+title+]</a> ([[MaxiGallery?  &gal_query_ids=`[+id+]` &display=`childgalleries` &galleryOuterTpl=`galleryInfo`]] pictures /  [[dittoCount? &id=`children2`]]  subdirectories)</p><br />


    This gives me a list of the subdirectories, with links that take me to those pages. Since all pages have a MaxiGallery call, even pages without current gallery images show up with a "Manage Images" button. Hooray!. This solves my navigation.

    PROBLEMS

    3a. MAXIGALLERY: In the above chunk (template) for the ditto call, the number of images in each gallery is retrieved using a maxigallery call and then in the template for that call, using the [+maxigallery.picscount+] placeholder. What I am actually getting is the SUM of the number of pictures in the gallery and all it’s first-tier subgalleries. How do I get the count of the pictures in the gallery itself, without also counting the subgalleries?

    3b. NOT MAXIGALLERY: Next to each subdirectory/subgallery link I am trying to list the number of pictures and the number of subgalleries nested within it (to one level deep). I am using a similar invisible saved ditto call, and then a snippit to get the number of returned results. The snippit looks like this:

    if($id) {<br />	$resource = $modx->getPlaceholder($id . "_ditto_resource");<br />	$c = count($resource);<br />	return($c);<br />}<br />?>


    In this instance I am not getting the correct value returned (always 0). If I change the Ditto &save parameter to `1`, I see a list of documents, so I know the Ditto call is correct. I realize this is not a MaxiGallery problem. I should post this elsewhere. drat.

    3c. MAXIGALLERY. Now when in use the manage button, the manager appear essentially twice on each page, I am assuming because there are two MG calls on each page (or more!). But interestingly, now my titles and descriptions don’t get saved if there is more than one MG call on the page, even if only the first has a manager option! Could it be because the second instance of the manager is overriding the first? Looks like some of my gallery-browsing features are incompatible with the manager, so perhaps the above points are moot.
      Revo 2.0.8-pl
      • 7923
      • 4,213 Posts
      3a: What are the maxigallery calls and ditto templates you mean?
      3b: yeah, not maxigallery related..
      3c: Yep, if you have more than one maxigallery calls on a document and try to do picture management on that same document, it won’t work. You need to use the &manage_target and &is_target parameters of maxigallery to make the picture management on a separate document (see wiki page for these parameters), or patch your maxigallery code with this. I’m going to put that into maxigallery at some point anyways.. then you can use &manage=`0` to the calls where picture management should not happen.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 20413
        • 2,877 Posts
        You can use multiple ditto call by assigning them and placeholder id’s.
        Then check out this:
        http://modxcms.com/forums/index.php/topic,33398.msg203214.html#msg203214

          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower