We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33372
    • 1,611 Posts
    Hey there, Tom -

    I think that you need to hack the snippet and database table a little bit to make this work. That’s the way that I did it anyway. I’m doing exactly the same thing as it sounds like you want to do (main gallery page and image management in English, but also showing the same galleries with Spanish titles and descriptions on other pages), and that’s what worked for me.

    Essentially what I did in the English MaxiGallery snippet is just to add two more fields to the database table (title_esp and descr_esp) and also add those fields to the image management forms and logic. So from that page and using that snippet you do all your image management (in English and Spanish). I thought that this was the best approach, since that way you could see both languages, copy and paste, etc.

    Then I made a duplicate snippet as the Spanish MaxiGallery version, but I removed all of the forms and image upload/management code from it (it’s only used to display the images that the other snippet manages). Next I changed the title and description fields and other text content in the snippet to use the Spanish versions. And lastly you need to pass the document ID of the page that the English gallery is on so that this snippet will look for the photos related to that page and not this one.

    In my case, each page on the site (English or Spanish) already has an Alternate Language ID template variable that’s used for creating links to the page in the other language, so I just used the value from that TV. But you could place the document ID of the English gallery in the snippet call on the Spanish page if you like. Then you modify the $path_to_gal variable so that instead of using the ID of the current (Spanish) page it uses the ID of the main (English) page (something like this: $path_to_gal=$path_to_galleries.$maindocID."/"; ).

    My files are horrendously hacked and incomprehensible (on a tight deadline, all you care about is whether it works or not), but if you want to see them PM me and I’ll send them to you.
      "Things are not what they appear to be; nor are they otherwise." - Buddha

      "Well, gee, Buddha - that wasn't very helpful..." - ZAP

      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
      • 7923
      • 4,213 Posts
      If you wouldn’t need different titles and descriptions, it would be very simple.. my dev code allready has view_gallery parameter what you can use to view a gallery from another document in some document. For this to happen you would:

      add:

      $mgconfig['view_gallery'] = (isset($view_gallery)) ? $view_gallery : ""; // [ number | empty ]
      


      then replace:
      if($mgconfig['is_target']==true && $_REQUEST['gal_id']){
      	$pageinfo=$modx->getPageInfo($_REQUEST['gal_id'],0, "id, pagetitle, longtitle, description, alias, createdby");
      }else if($mgconfig['manage_gallery']!=""){
      	$pageinfo=$modx->getPageInfo($mgconfig['manage_gallery'],0, "id, pagetitle, longtitle, description, alias, createdby");
      }else{
      	$pageinfo=$modx->getPageInfo($modx->documentIdentifier,0, "id, pagetitle, longtitle, description, alias, createdby");
      }
      

      with:
      if(mgconfig['is_target']==true && $_REQUEST['gal_id']){
      	$pageinfo=$modx->getPageInfo($_REQUEST['gal_id'],0, "id, pagetitle, longtitle, description, alias, createdby");
      }else if(mgconfig['manage_gallery']!=""){
      	$pageinfo=$modx->getPageInfo(mgconfig['manage_gallery'],0, "id, pagetitle, longtitle, description, alias, createdby");
      }else if(mgconfig['view_gallery']!=""){ 
      	$pageinfo=$modx->getPageInfo(mgconfig['view_gallery'],0, "id, pagetitle, longtitle, description, alias, createdby");
      }else{
      	$pageinfo=$modx->getPageInfo($modx->documentIdentifier,0, "id, pagetitle, longtitle, description, alias, createdby");
      }
      


      But if you do need separate titles and descriptions for the pictures depending on what document they are, then you would indeed need to hevily hack the code.

      I wouldn’t want to say this, but in the next version (yeah yeah, this line again, you thinking? wink), there can be a support for custom fields, like in Jot for example, so you can also have as many fields as you want in one pic, but that depends if I get it crammed in.. That would go perfectly with the templating, so that you could have spanish descriptions in the template for spanish galleries and so on.. But I’ve had extremely hard time lately to get my self doing anything with this snippet, but I will get it done sooner or later, I can promise that.



        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 33372
        • 1,611 Posts
        Actually if you do what doze suggests above then the other changes don’t seem that huge to me. Just look for every place where "title" and "descr" are referenced and add similar code in the same place that saves/displays your alternate language title and description (say "alt_title" and "alt_descr"). You may also want to add a $display_language var that you set in the snippet call and use that to determine which text to display in your gallery, but that way you’d only have one snippet instead of the two that I’m using.
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 30269
          • 119 Posts
          Got it working now:

          Changed the MaxiGallery code like doze suggested (but this time with $ in front of mgconfig wink ):

          if($mgconfig[’is_target’]==true && $_REQUEST[’gal_id’]){
          $pageinfo=$modx->getPageInfo($_REQUEST[’gal_id’],0, "id, pagetitle, longtitle, description, alias, createdby");
          }else if($mgconfig[’manage_gallery’]!=""){
          $pageinfo=$modx->getPageInfo($mgconfig[’manage_gallery’],0, "id, pagetitle, longtitle, description, alias, createdby");
          }else if($mgconfig[’view_gallery’]!=""){
          $pageinfo=$modx->getPageInfo($mgconfig[’view_gallery’],0, "id, pagetitle, longtitle, description, alias, createdby");
          }else{
          $pageinfo=$modx->getPageInfo($modx->documentIdentifier,0, "id, pagetitle, longtitle, description, alias, createdby");
          }

          Created a new snippet that calls the MaxiGallery

          <?php
          $gallery_source_id = $modx->documentIdentifier;

          if ($gallery_source_id==409) {$gallery_source_id=161;}
          if ($gallery_source_id==410) {$gallery_source_id=163;}
          if ($gallery_source_id==414) {$gallery_source_id=162;}
          if ($gallery_source_id==415) {$gallery_source_id=180;}
          if ($gallery_source_id==416) {$gallery_source_id=183;}
          if ($gallery_source_id==417) {$gallery_source_id=184;}
          if ($gallery_source_id==418) {$gallery_source_id=246;}

          return $modx->runSnippet(’MaxiGallery’, array (
          ’pic_use_watermark’ => 1,
          ’pic_watermark_type’ => ’text’,
          ’pic_watermark_txt’ => ’(c) copyright ’,
          ’pic_watermark_font’ => 1,
          ’pic_watermark_txt_color’ => 333333,
          ’pics_in_a_row’ => 50,
          ’max_thumb_size’ => 80,
          ’thumb_use_dropshadow’ => 1,
          ’quality_pic’ => 100,
          ’display’ => ’embedded’,
          ’embedtype’ => ’lightboxv2’,
          ’keep_bigimg’ => 1,
          ’big_img_linkstyle’ => ’popup’,
          ’display_manage’ => 0,
          ’is_target’ => 0,
          ’view_gallery’ => $gallery_source_id
          ));
          ?>
            • 22289
            • 41 Posts
            I have implemented the IE container solution and defined my uses of maxiGallery within a DIV tag where height is equal to 1%. This seems to have solved all MaxiGallery display issues that I know of- especially on IE6. The problem is, I am taking a beating from a client who is on the road looking at a MaxiGallery page on hre IE6 (6.0.2900.2180.xpsp_sp2_gdr.050301-1519) who sees, literally nothing where this snippet is used. On IE6 where I’ve tested it, the fix worked. Is this a caching issue of some sort?
              • 33372
              • 1,611 Posts
              I’ve never heard of the IE container solution, and I’ve used MaxiGallery in IE6 a lot with no problems. I usually use float:left divs for each row, and I define a height and line-height equal to my maximum thumnail height so that all images are centered vertically in rows of the same height. I find that almost all of the problems with IE6 go away when you use an XHTML doctype, since that forces it into standards-compliant mode.
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                • 31227
                • 198 Posts
                guys i am having a problem with maxigallery.
                the problem is that I have a flash header and the ajax + lightbox goes under the flash so the images under the flash header, how can this be fixed?
                  Pure MODx sites
                  Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
                  • 31227
                  • 198 Posts
                  anyone?
                    Pure MODx sites
                    Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
                    • Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 20079
                      • 49 Posts
                      Very nice!
                      I run into 1 problem through. Hope they are easy 2 solve:

                      [tt]Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 5112 bytes) in /opt/web/clients/ladiesstreetshop/ladiesstreetshop.lv/htdocs/assets/snippets/maxigallery/watermark/Thumbnail.class.php on line 183[/tt]

                      This discussion is closed to further replies. Keep calm and carry on.