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
    In order to make it more comfortable to the editor: is it possible to "style" the MIGX table in the backend in a way so it better reflects the design of the website? If the editor uses h1, h2 or a table tag, the styles of the MODX backend are shown in the MIGX backend... it’s a little bit confusing then.

    did you try the preview-feature?
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 8323
      • 14 Posts
      Is there a way to pull one migx tv from multiple resources?

      I have a gallery which has categories, every category is a separate resource under main gallery page and it’s content is handled by migx.
      Gallery
      - Category A (MIGX)
      - Category B (MIGX)
      - Category C (MIGX)

      What I would like to do is to pull array of all images in all categories and display few of them (probably in random order) on the main gallery page as a slideshow.

      Docid property of getImagesList allows only for one resource as far as I can tell.

      Thank you.
        • 4172
        • 5,888 Posts
        not sure, if this does actually work, but something like that can do it:

        snippet:

        <?php
        
        //[[mergeMIGX? &tvname=`mymigxtv` &docids=`10,11,12` &tpl=`mytpl`]]
        
        $docids = explode(',', $docids);
        
        if ($tv = $modx->getObject('modTemplateVar', array('name' => $tvname))) {
        
            foreach ($docids as $docid) {
                $outputvalue = $tv->renderOutput($docid);
                $items = $modx->fromJSON($outputvalue);
                $allitems = array_merge($allitems, $items);
            }
        $scriptProperties['value'] = $modx->toJSON($allitems);
        }
        
        return $modx->runSnippet('getImageList',$scriptProperties);
        
        ?>


        and use it as you would normally do it with getImageList, but with the property &docids=`15,16,17`


          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 8323
          • 14 Posts
          Very close my friend. This is what got me going:
          <?php
          
          $docids = explode(',', $docids);
          
          if ($tv = $modx->getObject('modTemplateVar', array('name' => $tvname))) {
              foreach ($docids as $docid) {
                  $outputvalue = $tv->renderOutput($docid);
                  $items = $modx->fromJSON($outputvalue);
                	$allitems = array_merge((array)$allitems, (array)$items);
              }
          }
          
          $scriptProperties['value'] = $modx->toJSON($allitems);
          
          return $modx->runSnippet('getImageList',$scriptProperties);
          ?>
          


          The only change is:
          $allitems = array_merge((array)$allitems, (array)$items);
          


          As error log output was:
          (ERROR @ /home/content/49/8083049/html/core/cache/includes/elements/modsnippet/41.include.cache.php : 15) PHP warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array
          


          Which comes from PHP5 documentation:

          The behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() now only accepts parameters of type array.
          http://php.net/manual/en/function.array-merge.php

          You truly are brilliant Bruno.
          Thank you!
            • 36591
            • 38 Posts
            Sorry, but I get an error with the code of dzes. I'm using PHP5 and by calling the mergeMigx snippet I get this error
            core/cache/includes/elements/modsnippet/53.include.cache.php : 324) PHP warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed


            53 is the getImageList Snippet. If I use the original code of Bruno17 I get another error

            includes/elements/modsnippet/57.include.cache.php 16) PHP warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array


            57 is the mergeMigx Snippet. But this error should be the one dzes also explained (array_merge() changes in PHP5).

            mergeMigx call:
            [[!mergeMigx?
                &tvname=`commercialRubric`
                &docid=`42`
                &tpl=`commercialRubricOutputInner`
                &where=`{"publishPage:=":"[[*id]]"}`
                &limit=`10`
             ]]


            Edit: I'm using Migx 1.1.0 rc2 [ed. note: waivor last edited this post 15 years ago.]
              • 36917
              • 2 Posts
              Hi,
              I have a issue with MIGX 1.1.0-rc2 and Modx 2.2.0-dev. When I try to add item get this:
              Fatal error: Call to a member function fetchTemplate() on a non-object in /core/model/modx/processors/element/tv/renders/mgr/input/text.php on line 8

              I never had any issues in previous versions.
              For testing I use this:
              Forms:
              [
              {"caption":"Info", "fields": [
                  {"field":"title","caption":"Title","description":"Title for the image."}, 
                  {"field":"description","caption":"Description","inputTV":"richtext"}
              ]}, 
              {"caption":"Image", "fields":[
                  {"field":"image","caption":"Image","inputTV":"image"}
              ]}
              ] 


              Grid:
              [
              {"header": "Title", "width": "160", "sortable": "true", "dataIndex": "title"}, 
              {"header": "Image", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"}
              ]


              I have created TVs: image and richtext of course.

              Does anybody know what might be wrong?

                • 4172
                • 5,888 Posts
                MIGX isn't tested for revo 2.2.0-dev.
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 22347 ☆ A M B ☆
                  • 29 Posts
                  Orbital Alliance Reply #168, 15 years ago
                  Moonmaker, what settings did you setup to get images to display for contexts? We're experience the same issue with images not showing up in the display for the contexts. Are there specific settings you need to setup both in the image TV as well as creating specific context variables?

                  Appreciate your assistance.
                    "Give a company a website, and they will be successful for now...
                    Give a company a long-term web strategy, and they will be successful for a lifetime."

                    Company Website: http://www.orbitalalliance.com
                    Company Blog: http://www.orbitalalliance.com/blog
                    • 37032
                    • 64 Posts
                    Hello Bruno and thanks for a great extension!

                    I have a small problem that I hope you can help me with. I'm using your MIGX to output product-related document(s). My problem is that I first need to check the TV's value, so that I do not render the surrounding HTML if the value is empty. That does not work properly at the moment.

                    The template file looks something like this:

                    [[*productDoc:!empty=`
                    <h2>Title</h2>
                    <ul class="file-list">
                    [[getImageList? &tvname=`productDoc` &tpl=`productDoc`]]
                    </ul>`]]


                    If I remove the document and re-save my resource, the <h2>Title</h2> still renders. First after clearing the manager cache it disappears. Any idea how I can get this to work?

                    TIA
                      • 14951
                      • 151 Posts
                      @tomahl What is the output of just
                      [[*productDoc]]
                      ?

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