We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5102
    • 9 Posts
    I’m in the process of setting up a blog on a new ModX based site for a photographer friend. In order to allow her to easily upload images to her posts I’ve set up MaxiGallery to handle the upload and watermarking of the images. Everything is working exactly as I would expect on the single post pages within the "blog", the problem is with the summary page.

    When the summary page comes across a post that is using MaxiGallery, it is not parsing the MaxiGallery snippet, but is instead displaying the unparsed snippet call alongside the content.

    To allow her some flexibility with the positioning of the gallery within the post, the MaxiGallery snippet is being called from within a chunk, although I have also tried adding the gallery directly to the page as a snippet.

    Is it just the case that Ditto is unable to process snippets from the external documents that are being called, such as MaxiGallery, to generate the summary listings, or am I missing something?

    I’m running Ditto 2.1, my Ditto call is below.
    [!Ditto? &id=`rdBlog` &startID=`6` &display=`5` &removeChunk=`Comments` &tpl=`rd.BlogSummaryPost` &paginate=`1` &dateFormat=`%A %B %e, %G at %T` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &sortBy=`pub_date`!]


    Thanks.
      • 3749
      • 24,544 Posts
      Seeing the snippet call instead of the snippet output usually means that the Rich Text Editor has converted characters in the call to HTML entities so MODx no longer recognizes it as a tag and just sends it on to the browser. Look at the snippet call in the Chunk with Editor set to "none."
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 5102
        • 9 Posts
        Thanks for the reply Bob.

        Chunks are set to have the Rich Text Editor disabled by default, and I haven’t changed this. Just double checked the snippet code within the chunk, and everything appears to be as it should.
        [!MaxiGallery? &max_thumb_size=`150` &max_pic_size=`530` &keep_bigimg=`1` &galleryOuterTpl=`rd.BlogSingleImageOuter` &galleryPictureTpl=`rd.BlogSingleImageLeftTpl` &pic_use_watermark=`1` &pic_watermark_type=`image` &pic_watermark_img=`assets/templates/reddoor/images/gallery-pic-watermark.png` &pic_watermark_valign=`bottom` &pic_watermark_halign=`left` &big_use_watermark=`1` &big_watermark_type=`image` &big_watermark_img=`assets/templates/reddoor/images/gallery-big-watermark.png` &big_watermark_valign=`bottom` &big_watermark_halign=`left` &max_pic_number=`1`!]

        Just to try and eliminate it as a possibility I also saved the page in question with the rte disabled to make sure that nothing was going on there, still no change.

        I’ve been searching around for a possible solution/reason for this for most of the afternoon and not been able to find anything, which probably means that it’s something painfully obvious that I’m missing. smiley
          • 5102
          • 9 Posts
          Looking in the Ditto Debug Console I can see that the chunk code is in the right place for where I want it.
          <p>{{rd.BlogSingleImageLeft}}

          If I use the previously mentioned MaxiGallery snippet it just outputs the snippet itself from the chunk, without any parsing at all. However if I change it to a cacheable snippet [[ snippet code here ]] I don’t get any output at all when not logged in. If I’m logged into the manager then I’ve just discovered that I can see the "Manage pictures" button.

          I think what is going on now is that it’s trying to run MaxiGallery on the Summary page where no gallery exists. How I’m going to get around this, if at all is a whole other thing I think.

          Update:
          I’ve managed to throw together a snippet to allow me to set the correct value for "&gal_query_ids" in MaxiGallery. This now allows me to display the MaxiGallery content on both the Blog summary page(Ditto) and the normal single post page.
          <?php
          $rdBlogId = $modx->documentIdentifier;
          
          $galleryIdSrc = $rdBlogId;
          
          if($rdBlogId == '6'){ //Id of page hosting Ditto Snippet
          	$galleryIdSrc = '[+id+]';
          }else{
          	$galleryIdSrc = $rdBlogId;
          }
          $modx->setPlaceholder('rdBlogGalleryIdSrc', $galleryIdSrc);
          
          return $modx->getChunk('rd.BlogSingleImageLeft');
          ?>

          Only issue I have left remaining is that while I can now get all of the images to display as I wanted, I can no longer add/delete/edit them. It seems that now MaxiGallery is refusing to see that I am logged in as an admin and show me the "Manage Pictures" pictures. Could be an issue for another forum though if I don’t have any luck with it.