We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    Thank you, bwente - your posting was crossing with mine.
    href="[+images_dir+][+filename+]"
    will display the correct big image - but on a empty tab; the template for my Photo page (id=15) is ignored.
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Did you try to call the getPicId snippet in [tt]&picId=`[[getPicId]]`[/tt] uncached?

      What you quoted from the documentation is correct, if &picId is not specified, it does a $_REQUEST[’picID’] to fill it.


      AFAIK, specifiying [tt]href="[~15~]?picId=[+id+]"[/tt] in your thumbs template should do the trick, and you can leave out the getPicId snippet. Note that I changed your [tt]&[/tt] to [tt]?[/tt] - from what I can see your picId variable is the first, so it should be given with a question mark instead of the ampersand sign (which you use for the second and further).

        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 22427
        • 793 Posts
        No, it has to be [tt]href="[~15~]&picId=[+id+]"[/tt] , because [tt][~15~][/tt] is resolved to [tt]index.php?id=15[/tt] , so [tt]picId[/tt] is the second parameter...
          • 22427
          • 793 Posts
          I cite myself from above:
          If I go back to the Gallery page (using the back button of the browser) and click on another thumb there will be shown the same big image as before - obviously the page is fetched from the cache. Edit: Clearing the cache does not change this behaviour.
          Here I meant the browser cache. But clearing the cache of the MODx manager helps.
          As a consequence, it would solve my problem if I could force the clearing of the manager cache before each showing up of the Photo page. Is there any way to do this?
            • 22427
            • 793 Posts
            Hi again!
            To transfer the picture data of the thumbnail link to the Photo page, I now did the following:

            In the [tt]tpl_thumb[/tt] I added a parameter [tt]picDataString[/tt] to the URL of the link:
            <a class="thumb" href="[~15~]&picDataString=[+id+]~[+images_dir+]~[+filename+]~[+title+]"><img src="[+thumbs_dir+][+filename+]" alt="[+title+]" title="[+title+]" /></a>

            So a click on the link will store this information of the individual picture in the global variable [tt]$_GET[/tt] ; so it can be accessed from the Photo page via [tt]$_GET[’picDataString’][/tt] . In a snippet I can access the single informations by exploding the string into an array.
            To get the path information of the picture file I use this snippet [tt]"getPicFile"[/tt] :
            <?php
            $pdstring = $_GET['picDataString'];
            $pdarray = explode("~", $pdstring);
            echo "$pdarray[1]"."$pdarray[2]";
            ?>
            A similar snippet [tt]"getPicId"[/tt] delivers the [tt]picId[/tt] of the picture:
            <?php
            $pdstring = $_GET['picDataString'];
            $pdarray = explode("~", $pdstring);
            echo "$pdarray[0]";
            ?>
            The EG call in the Photo page (id=15) now becomes the following:
            [[EvoGallery?  &type=`single` &picId=`[!getPicId!]` &display=`single` &itemTpl=`tpl_foto`]]

            Here the template [tt]tpl_foto[/tt] had to be changed into this:
            <img class="foto" src="[[getPicFile]]" alt="[+title+]" title="[+title+]" />

            I think this looks fine so far - but the big problem remains:
            Going back to the Gallery page and clicking another thumb link will not update the variable [tt]$_GET[’picDataString’][/tt] - it is fetched again from the manager’s cache.
            How can I force MODx to take the new value of [tt]picDataString[/tt] for [tt]$_GET[/tt] ?
            Any hints are much appreciated!
            Best regards
            ottogal
              • 22427
              • 793 Posts
              Problem solved!
              It’s so easy: I just had to change the cached/uncached sequence of the nested snippets from [tt][[...[!...!]...]][/tt] to [tt][!...[[...]]...!][/tt] , so the EG call gets
              [!EvoGallery?  &type=`single` &picId=`[[getPicId]]` &display=`single` &itemTpl=`tpl_foto`!]

              (I’m quite sure having played around with this before. But moving from one Notebook to another it seemes I used a backup of the database which was really recently done, but contained the faulty snippet code.)
              Thanks to all who spent their time thinking over this case.
              Best regards
              ottogal
                • 4385
                • 372 Posts
                Quote from: bwente at Aug 03, 2010, 06:45 AM

                I think it would be nice to be able to limit galleries to certain templates. I trying to make this thing "client-proof". How about something like this?
                $filter = "WHERE c.template = '" . $templateId . "'";
                however this will flatten out the parent child structure.

                Is there a way to preserve it? If I do an "AND" I lose the children, since the parent does not have the same template ID.

                I would like to use a parameter like Ditto to pass a string of document id’s that can only have galleries, but I think it would make more sense to limit by templates. Any ideas?
                  DropboxUploader -- Upload files to a Dropbox account.
                  DIG -- Dynamic Image Generator
                  gus -- Google URL Shortener
                  makeQR -- Uses google chart api to make QR codes.
                  MODxTweeter -- Update your twitter status on publish.
                  • 10720
                  • 26 Posts
                  I can’t upload images to the webserver. I checked all the suggested by bravado on page 1. Locally, everythin gis fine.
                  What could I do?
                    • 4385
                    • 372 Posts
                    Quote from: bwente at Aug 14, 2010, 09:38 AM

                    Quote from: bwente at Aug 03, 2010, 06:45 AM

                    I think it would be nice to be able to limit galleries to certain templates. I trying to make this thing "client-proof". How about something like this?
                    $filter = "WHERE c.template = '" . $templateId . "'";
                    however this will flatten out the parent child structure.

                    Is there a way to preserve it? If I do an "AND" I lose the children, since the parent does not have the same template ID.

                    I would like to use a parameter like Ditto to pass a string of document id’s that can only have galleries, but I think it would make more sense to limit by templates. Any ideas?

                    Okay, I forgot about managermanager. Which can provide a link directly to the module. But is does not prevent the user from hitting the back button in the module and go up a level.
                      DropboxUploader -- Upload files to a Dropbox account.
                      DIG -- Dynamic Image Generator
                      gus -- Google URL Shortener
                      makeQR -- Uses google chart api to make QR codes.
                      MODxTweeter -- Update your twitter status on publish.
                      • 26931
                      • 2,314 Posts
                      I think it would be nice to be able to limit galleries to certain templates
                      bwente , i’m not 100% sure what you try to accomplish ... why don’t you just create a "gallery" template which includes your call? or setup a Radio TV in order to include a chunk with the snippet call, or not?