We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18913
    • 654 Posts
    I’m trying to get thumbnails and a large image to show on one page using Maxigallery v0.5.2, using the basic approach and code seen here :
    http://wiki.modxcms.com/index.php/MaxiGallery#Picture_and_thumbnails_on_same_page

    So there are two Maxigallery calls on one page.

    The main Maxigallery call is
    [!MaxiGallery? &pictureTpl=`mgPicture` &display=`pictureview`!]


    The template to display a single image (mgPicture) is
    <div class="picturecontainer">
           <img id="maxImage" src="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" alt="" />
           <p id="maxTitle">[+maxigallery.picture.title+]</p>
           <p id="maxDescr">[+maxigallery.picture.descr+]</p>
    </div>


    The second call is
    [!MaxiGallery? &galleryPictureTpl=`mgGalleryPicture` &js=`mgJs` &max_thumb_size=`125x100` &manage_target=`23` !]


    The template for the thumbnails (mgGalleryPicture) is
    <li>
           <a href="javascript:void(0);" onClick="javascript:showPic('[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]','[+maxigallery.picture.title:htmlent+]','[+maxigallery.picture.descr:htmlent+]',[+maxigallery.picture_width_normal+],[+maxigallery.picture_height_normal+]);return false;">
                   <img src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" />
           </a>
    </li>


    The title for each images is something like
    <b>Visit </b>: <a href="http://www.example.com" target="_blank">example website</a>
    and the description for each is just
    Lorem <b>ipsum</b> ...
    So - both the title and description has html which I would like to be rendered properly.

    The single large image renders fine when the page is first loaded, as I have removed ":htmlent" from the template. But I am running into problems with the template used for presenting the thumbnails. Whenever I click on one of the thumbnails the large picture is presented with the title just showing "raw" html. Further, if I click on the thumbnail twice, two copies of the title are shown (one appended to the other). So I’ll see something like this below the large image :
    The titlefourth title
    
    the <b>description</b>fourth description


    Playing with :htmlent and :notags hasn’t gotten me anywhere. I’m wondering if the issue is how the showPic code is processing the title and description fields, but frankly haven’t worked with Maxigallery enough to know.

    Has anyone had a similar issue and managed to find the solution? Or, i I just approaching this all wrong and there’s a better way that could be described? The endpoint I’m looking for is a block of thumbnails which, when clicked upon, bring up a larger version of the image, below which is a title (that includes a hyperlink) and description, each including various html tags.

    TIA,
    Matt

    PS : I have gone through many of the links in the sticky post at the top of the forum and tried to figure out what to do from topics like these :
    http://modxcms.com/forums/index.php/topic,36134.0.html
    http://modxcms.com/forums/index.php/topic,20662.0.html
    http://modxcms.com/forums/index.php/topic,35324.0.html
    http://modxcms.com/forums/index.php/topic,31370.0.html

    If I’ve missed an important one and someone could provide a link, I’d be appreciative.
      • 26931
      • 2,314 Posts
      Matt, maybe this helps: http://bit.ly/6JpSPk
        • 18913
        • 654 Posts
        Thanks for that. Your second set of JS does what I was looking for, so I’m very appreciative! One quick question : is there no equivalent JS to the .html() function (found in the second example) that could be used in the first example?

        Anyway, thanks again - the html is coming through fine.
        MattC
          • 26931
          • 2,314 Posts
          Hi Matt ...sorry, didn’t read your thread carefully enough

          you would also need to remove :htmlent from managepicturetpl.html ( -> [+maxigallery.picture.title+] -> [+maxigallery.picture.descr+] ) in snippets/maxigallery/templates

          see: http://bit.ly/cq88Kn
            • 18913
            • 654 Posts
            Yup, that’s exactly what I was shooting for. Though it seems that :htmlent must be included in the template used to display the thumbnails, but not in the template used for the larger picture. Or, rather, if I don’t do that, I see text displayed near the thumbnail.

            Thanks for the example!
            MattC