We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    about line 245 in getImageList change:

                    if ($tv = $modx->getObject('modTemplateVar', array('name' => $inputTvs[$field]))) {
                        $tv->set('default_text', $value);
                        $fields[$field] = $tv->renderOutput($docid);


    to

                   if ($tv = $modx->getObject('modTemplateVar', array('name' => $inputTvs[$field]))) {
                        if (is_array($value)){
                            $value = implode('||',$value);
                        }                    
                        $tv->set('default_text', $value);
                        $fields[$field] = $tv->renderOutput($docid);
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 23018
      • 353 Posts
      @Bruno

      Thank you that really hit the spot.

      I have added a new snippet parameter near the top

      $delimiter = $modx->getOption('delimiter', $scriptProperties, '||');
      


      and modified the is_array() Part:

      					if (is_array($value)){
      						$value = implode($delimiter,$value);
      					}  
      


      One last question. Before I added those modifications the double pipe (||) wasn’t shown as delimiter. Any clue why this happens?

      Regards,

      pepebe
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
        • 4172
        • 5,888 Posts
        you can set a delimiter for your checkbox-tv and use delimited as output-type.

        $tv->renderOutput() will add the delimiters between the values.

        If you don’t set any delimiter for your TV there will be no delimiters, of course.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 31912 MODX Staff
          • 95 Posts
          I just updated to the most recent version and it seems like the disappearing popup issue has been resolved without modifying any CSS. Again, thanks for the great TV. I think this is a game changer for any structured content that needs to appear on a single page that I typically simulate with child documents – this is a much cleaner approach for clients.

          I also use ExpressionEngine (depending on the project’s needs) and this add-on provides very similar functionality as Matrix and something I always wanted when working with MODx: http://pixelandtonic.com/matrix . Would it be possible to handle the content entry directly part of the grid in a future version similar to Matrix (rather than in a popup) or does this need to be handled this way because of extjs? If it is possible, I would be interested in funding this through a future project’s budget and would love to discuss/price it out.
            • 4172
            • 5,888 Posts
            what I can see on the matrix-docu, you can only edit your contents directly on the grid. I think that isn’t that flexible than it is with a configurable editor-window, where you can have each kind of TVs and custom-TVs categorised by tabs and for example the new form-switching-feature.
            Of course it would be possible todo inline-editing of some fields, but with a lot of fields this comes a bit unhandy at some point and you will need an extra form for editing additional infos again. Also sorting by drag/drop with big grid-cells isn’t that comfortable than with small cells, where you have only some important fields.

            What I can think of, is a frontent-editing as we did it with xedit, where you can add/edit and sort stuff directly and inline on your front-page.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 436 ☆ A M B ☆
              • 265 Posts
              For some reason I can’t get the new &toSeparatePlaceholders property to work

              My getImageList call looks like this:

              [[!getImageList? &tvname=`image-grid` &toSeparatePlaceholders=`articleimage` &tpl=`article-image`]]

              with the &tpl code looking like:

              <img src="[[+image]] />

              Then in the documentation its a bit confusing; for &toSeparatePlaceholders it says use [[+articleimage.1]] but this doesn’t seem to work; and when adding the &placeholdersKeyField property as &placeholdersKeyField=`image` I tried [[+articleimage.firstimage]] [[+articleimage.1image]] and also [[+articleimage.1.image]] but none of those worked either.

              Any idea what I might be missing here? What is the correct syntax for the separate placeholders?

              As a note, &toPlaceholder=`articleimage` and then putting [[+articleimage]] into my template does work; it seems to be just the separate placeholders I can’t get working.
                MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                • 4172
                • 5,888 Posts
                this does work for me:

                [[!getImageList? 
                &tvname=`multiitemsgridTv2` 
                &toSeparatePlaceholders=`articleimage` 
                &tpl=`@CODE:<img src="[[+image]]"/>` ]]
                some Text :[[+articleimage.0]] <br/>
                more Text: [[+articleimage.2]]


                note: the key begins with ’0’
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 25803 ☆ A M B ☆
                  • 721 Posts
                  I’ve downloaded the June 9th release. This is a spectacular package. We’ve created an array of quotes and have the following call in our footer:

                  [[!getImageList? 
                      &tvname=`quotations`
                      &tpl=`quotations`
                      &limit=`1`
                      &randomize=`1`
                      &docid=`[[doclookup?&alias=`administration/admin-quotes.html`]]`
                  ]]
                  


                  The docid value is running a snippet that grabs the document ID based on FURL structure since we’ll be making contexts from the master context but we’ve tried it with a direct value, such as 3, as well.

                  So it pulls the first quote from the array, along with the author and the location of the author but we want it to randomly pull from the array. We’ve set the limit to 3 and sure enough all of the current one’s show just to confirm they are all there in the array. But we always get the same quote, despite having randomize set to 1.
                    • 4172
                    • 5,888 Posts
                    this is a bug.

                    for a quick fix try this:

                    change

                        //preselect important items
                        if ($randomize && $preselectLimit > 0) {
                            $tempitems = array();
                            for ($i = 0; $i < $preselectLimit; $i++) {
                                $tempitems[] = $items[$i];
                                unset($items[$i]);
                            }
                            shuffle($items);
                            $items = array_merge($tempitems, $items);
                        }


                    to

                        //preselect important items
                        if ($randomize) {
                            $tempitems = array();
                            if ($preselectLimit > 0){
                                for ($i = 0; $i < $preselectLimit; $i++) {
                                    $tempitems[] = $items[$i];
                                    unset($items[$i]);
                                }
                            }
                            shuffle($items);
                            $items = array_merge($tempitems, $items);
                        }
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 25803 ☆ A M B ☆
                      • 721 Posts
                      Great, that fixed it.

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