for me I would use my snippet Xett for this.
have to create a new projectfolder with the file getdatas.php in the includes-projectfolder:
<?php
$startid='819';//the gallery-folder
$imagecount=0;
$yeardocs=$modx->getDocumentChildren($startid);
$out_yeardocs=array();
if (count($yeardocs)>0){
foreach($yeardocs as $yeardoc){
$year=$yeardoc['pagetitle'];
$monthdocs=$modx->getDocumentChildren($yeardoc['id']);
$out_monthdocs=array();
if (count($monthdocs)>0){
foreach($monthdocs as $monthdoc){
$month=$monthdoc['pagetitle'];
$imagedocs=$modx->getDocumentChildren($monthdoc['id']);
$out_imagedocs=array();
if (count($imagedocs)>0){
foreach ($imagedocs as $imagedoc){
$imagecount++;
$imagedoc['count']=$imagecount;
$imagedoc['month']=$month;
$imagedoc['year']=$year;
$out_imagedocs[]=$imagedoc;
}
}
$monthdoc['innerrows']['images']=$out_imagedocs;
$out_monthdocs[]=$monthdoc;
}
}
$yeardoc['innerrows']['months']=$out_monthdocs;
$out_yeardocs[]=$yeardoc;
}
}
$xettdatas['innerrows']['years']=$out_yeardocs;
?>
and in the templates-projectfolder these files:
xetouterTpl.html:
<gallery>
[+xett.innerrows.years+]
</gallery>
yearsTpl.html:
<year year="[+xett.row.pagetitle+]">
[+xett.innerrows.months+]
</year>
monthsTpl.html:
<[+xett.row.pagetitle+]>
[+xett.innerrows.images+]
</[+xett.row.pagetitle+]>
and imagesTpl.html:
<image id="[+xett.row.count+]" src="assets/[+xett.row.year+]/[+xett.row.month+]/[+xett.row.pagetitle+].jpg"/>
and call it with
[!Xett? &project_path=`xmltest` &service=`xmltest`!]
if the new createt projectfolders are
assets
-snippets
--Xett
---projectfiles
----xmltest
-----xmltest
------templates
------includes
made a test here:
http://www.red-dragon-cup.de/bocksbeutel/index.php?id=819 (you have to look to the sourcecode to see the result)