We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    I would like to signal a minor bug when having "Picture and thumbnails on same page" using the method given in the wiki.

    If the template for the main picture displays either image title or description, the corresponding field must not contain quotes. If quotes are not escaped (like this: \’), the thumbnail having such title or description does not display the large image when clicked.

    Escaping quotes is not a problem for a webmaster, but unfriendly for customers.

    Addition:
    But the major problem is that the escaping antislash prints when loading the page if it is contained in the description of the first picture. This is because the we are not passing through the Javascript script in that case.
      • 7923
      • 4,213 Posts
      You can create a custom phx modifier what escapes the placeholder data automatically and use that for the title and description placeholders.

      EDIT:

      Create a snippet "phx:slashandstrip" with this content:
      return addcslashes(htmlentities(preg_replace("~([\n\r\t\s]+)~"," ",$output)), "'");


      Then in your mgGalleryPicture chunk, change [+maxigallery.picture.title:htmlent+] to [+maxigallery.picture.title:slashandstrip+] in the thumbnail link onClick attribute.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 15001
        • 697 Posts
        Hi,

        Thank you for having taken time to answer.

        Well it works fine now with the quotes, but another problem appeared since I have a snippet call in the template used by MaxiGallery to display the main picture.

        This snippet call is now printed instead of the snippet being run.
        How can I avoid this?


        EDIT #2:
        Looks like the PHx plugin has the same effect that an additional snippet call.
        Inverting the type of brackets from uncached [!...!] to cached [[...]] mode, solved the problem. All works perfectly now. grin
          • 15001
          • 697 Posts
          If you use the "slashandtrip" phx modifier to escape quotes and your site uses utf-8, you must slightly modify it, so that the htmlentities() function uses that charset.
          <?php
          return addcslashes(htmlentities(preg_replace("~([\n\r\t\s]+)~"," ",$output),ENT_NOQUOTES,"utf-8"), "'");
          ?>

          By default, htmlentities() uses iso-8859-1. If your site uses utf-8, some characters in the picture description could print wrong if you don’t specify the charset explicitely.
          E.g. è would print as è when clicking a thumbnail.