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.