We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16895
    • 87 Posts
    Is there any way of creating a TV that gives a list of galleries from the Gallery addon and returns the ID of the gallery chosen? Failing that, are there any other solutions friendlier than having a user type in a gallery ID to attach a gallery to a particular page?

    I have looked creating a custom TV myself, but the docs are sketchy and I don’t know nearly enough Sencha/PHP to do it.
      • 4172
      • 5,888 Posts
      you can try this:

      create a chunk ’galleryoption’:

      ||[[+name]]==[[+id]]


      and use a dropdownTv with input-option-values:

      @EVAL return 'choose gallery==0'.$modx->runSnippet('GalleryAlbums',array('limit'=>'100','prominentOnly'=>'0','rowTpl'=>'galleryoption'));
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 16895
        • 87 Posts
        Thanks! That works almost perfectly.

        For some reason I can’t fathom,outputting the TV on a page returns it with a linebreak, which breaks any snippet calls it’s in. Using [[*gallery-id:strip]] seems to work fine though.
          • 36491
          • 36 Posts
          I used this method in Revo 2.1.3.

          In some pages it works perfectly, in others the TV resets to empty whenever I open the page for editing. Any idea, why?

          Jörg
            • 36009
            • 10 Posts
            Hey, yes from a quick test I am seeing the reset on the editing of the page.
            The value is still stored for the TV but I'm guessing the:
            ||[[+name]]==[[+id]]

            part of the code is the weakness -- It's only one way, and does not know what to display when the TV edit page is loaded.

            Unfortunately I have no idea how to fix it. I would really really like this to work if anyone has a suggestion.

            Conor
              • 1778
              • 659 Posts
              Hello
              Did you try to put your condition UNCACHED ?

              [[!+name]] ==[[!+id]] (just put a " ! "before the " + " sign)

              Not sure it's the answer, but it could...
              Cheers
                • 36664
                • 17 Posts
                Hi

                Gallery 1.4.0
                2 input-types of TV (galleryalbumlist, galleryitem) and 1 output-types (galleryitem) present.

                I am used input-types galleryalbumlist and output-types default for my TV

                Best Regards
                  • 30912
                  • 463 Posts
                  Just a note, i've recently tried this and I cant get it working perfectly IF you use a Radio or Checkbox as the Input type

                  Edit:

                  Ive managed to get this working but if you edit the said page with the gallery it loses the TV value.
                  TV: GalleryList
                  Input Type: Check Box
                  Input Options @EVAL return 'Choose Gallery'.$modx->runSnippet('GalleryAlbums',array('limit'=>'100','prominentOnly'=>'0','rowTpl'=>'galleryoption'));
                  Output Option: default

                  gallery option tpl

                  ||[[+name]]==[[+id]]


                  Call:

                  [[Gallery? &album=`[[*GalleryList]]` &thumbTpl=`FeaturedThumbs` &thumbWidth=`145` &thumbHeight=`98` &limit=`4` ]]

                  [ed. note: Tyreal2012 last edited this post 14 years, 8 months ago.]