My issue is not so much a problem as it is a wondering if there is a way to do what I’m doing a BIT easier.
I have a site that has a lot of pictures on several galleries. Each gallery has 6-16 pictures. Yes, that doesn’t sound like much, but it gets more complicated. This would be a piece of cake if the galleries would all have just a simple layout, you know, three thumbnails in a row and then as many rows as needed. However, my customer wants to make his own layouts so that, for example, one gallery has one picture above others, then three in a row, then two pictures on the next row etc. At top of it all, the customer wants to be able to manage galleries himself.
As I’ve been trying to solve this I have come to conclusion that the only way to do this is create each layout with css and then add MaxiGallery calls with "gal_query_ids" parameter with individual id’s on all the divs that should contain a picture. As a result I have >200 documents with a gallery with one picture on them. If I could only use position in embedded gallery, I wouldn’t have this issue. Then I would only have 33 documents. The most convinient way would of course be to use picture_id but then the customer would have to temper with the code in order to replace a picture and he really isn’t much of a computer wizard.
What do you guys make of this all? Am I doomed to duplicate a single picture gallery document over 200 times?
Few possibilities.. You could disable the automatic row layout (specify a large number for the pics_per_row parameter) and then use the [+maxigallery.picnumber+] or [+maxigallery.picpagenumber+] placeholders in galleryPictureTpl together with PHx to add row break after certain pictures (eg. the contents of clearerTpl).
See this.
Or you could do one document for the gallery with multiple gallery calls with &limit and &offset parameters. Eg. to show first picture is to use &limit=`1`, then elsewhere on the document, to show pics 2-4 is to use &limit=`4` &offset=`2`.. etc.
Atleast those options came to mind. In both cases, only one document per gallery is needed. If you are going to use multiple calls per document, it will be little bit slower to render the page and you also need to use &manage_target parameter to make the picture management on a separate document. If all pictures are same size and with same filter settings etc, you can have just one document to manage the galleries (with &is_target=`1` in the snippet call) and link all other calls to that document with the &manage_target parameter.
See MaxiGallery page in MODx wiki for better explanation of the parameters and you can download the latest working SVN code here:
rev 137
"He can have a lollipop any time he wants to. That's what it means to be a programmer."