We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9673
    • 52 Posts
    Bruno17
    now alright. thanks
      • 1331
      • 129 Posts
      Is it possible to call a MIGX list item into another resource?
        • 9673
        • 52 Posts
        MIGX can show multidateTV?
          • 4172
          • 5,888 Posts
          Quote from: abelafonte at Jun 29, 2011, 12:49 PM

          Is it possible to call a MIGX list item into another resource?

          see &docid-property: http://rtfm.modx.com/display/ADDON/MIGX.Frontend-Usage
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            Quote from: filchakov at Jun 29, 2011, 02:09 PM

            MIGX can show multidateTV?

            what do you mean by multidateTV?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 486
              • 4 Posts
              Hi Bruno,

              Thank you for your wonderful snippet, i have been playing around with modx revo and migx to make it work with http://www.infinite-scroll.com/ and colorbox jquery plugin, i have a page with lot’s MIGX images, i need to display 24 images on first page load, and the rest of images will be load by pagination and infinite-scroll plugin.

              i have tried your custom snippet from this post http://modxcms.com/forums/index.php/topic,63702.msg365065.html#msg365065 without no success, this is my setup.

              handleOffset snippet:
              <?php
              switch ($task) {
                  case 'set':
                      if (isset($_GET['offset'])) {
                          $total = $modx->getPlaceholder('migx_total');
                          $offset = $_GET['offset'] + 24;
                          $offset = $offset >= $total ? 0 : $offset;
                      } else {
                          $offset = 24;
                      }
                      return $offset;
                      
                      break;
                  case 'get':
                      $offset = isset($_GET['offset'])? $_GET['offset'] : 0;
                      $modx->setPlaceholder('migx_offset+24',$offset+24);
                      return $offset;
                  break;    
              
              }
              


              template code:
              <div id="galsites" class="grid_9">
              [[!getImageList? &offset=`[[!handleOffset? &task=`get`]]` &limit=`24` &totalVar=`migx_total` &tvname=`prodImg`&tpl=`thumbTpl`]]
              
              
              <a id="next" href="[[~[[*id]]? &offset=`[[!handleOffset? &task=`set`]]`]]">
              Next - [[+migx_offset+24]]/[[+migx_total]]</a>
              </div>
              


              and thumbTpl chunk :
              <div class="portfolio_item float alpha">
              <a title="[[+title]]" rel="prodslide" href="#">
              <span>[[+title]]</span>
              <img alt="[[+title]]" src="[[+image:phpthumbof=`w=223&h=112&zc=1`]]" />
              </a>
              <div style="display:none;">
              <div class="inline">
              <img alt="[[+title]]" src="[[+image:phpthumbof=`w=650&h=435&zc=1`]]" />
              <div>[[+description]]</div>
              </div>
              </div>
              </div>
              


              i hope you can help to achieve this.

              thanks in advance and sorry for my poor English.
                • 23018
                • 353 Posts
                Just a tiny hack to enable sorting a MIGx by ANY ot it’s columns.

                Add the following lines below /* get default properties */ near the top:

                $sortBy = $modx->getOption('sortBy', $scriptProperties, '');
                $sortOrder = $modx->getOption('sortOrder', $scriptProperties, 'asc');
                


                Just before $idx = 0; (arround line #122) add this bit of code:

                // v1.1
                			if( array_search( $sortBy , array_Keys($items) ) !== FALSE ) {			
                				foreach($items as $k=>$v) {
                					$b[$k] = $v[$sortBy];
                				}
                			        switch( $sortDir ) {
                					case'asc':
                						asort( $b );
                						break;
                					case'desc':
                						arsort( $b );
                						break;
                					default:
                						asort( $b );
                						break;
                					}
                
                				foreach($b as $key=>$val) {
                					$c[$key] = $items[$key];
                				}				
                				$items = $c;
                			}
                

                Edit: Please note that v1.0 was a cut’n’paste accident. This one works.


                Now you can call getImageList with 2 new parameters:

                &sortDir=`asc_or_desc`
                &sortBy=`add_dataIndex_here`

                Regards,

                pepebe

                P.S.: You may Please PM me if you have a trouble with this. I’m using this on a page that will be going live in a few days and it would be great to solve all issues that might show up...
                  Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                  • 36695
                  • 47 Posts
                  I am using MIGX successfully (it’s great!) to allow the user to select site resources and allocate them to positions/categories.

                  In general things are working: I have one "ResourceList" input TV and another standard drop down list, both of which save their values etc properly. However, in the grid view only the ID of the selected resource is visible (of course because this is the value saved from the ResourceList dropdown) and I want to show the title instead.

                  I have tried to create a new renderer, but can’t find a way of getting to the pagetitle. In fact, I can’t get a custom renderer function to work at all. I’ve tried adding a new function "renderResourceTitle" in core/components/migx/elements/tv/migx.tpl and migx_one.tpl, where the renderImage function is, but the value in the grid never changes despite what is returned from this function.

                  Any pointers very welcome...

                  Revolution 2.1.1, MIGX 1.1.0
                    • 4172
                    • 5,888 Posts
                    you can do this:

                    your options should look like this:

                    mypageitleA==mypagetitleA:theID


                    add a new renderer to the grid in migx.tpl

                    ,renderFirst : function(val, md, rec, row, col, s){
                    val = val.split(':');
                    return val[0];
                    } 


                    and add this renderer to your field in grid-columns like that:

                    {"header": "MYFIELD", "width": "100", "sortable": "false", "dataIndex": "myfield","renderer":"this.renderFirst"}, 


                    for frontend use a output-filter for that field.
                    new snippet 'renderSecond':

                    <?php
                    
                    $val = explode(':',$input);
                    return $val[1];



                    and use it this way:

                    [[+myfield:renderSecond]]






                    [ed. note: Bruno17 last edited this post 14 years, 7 months ago.]
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 36695
                      • 47 Posts
                      Thank you Bruno,

                      The problem I was having was that a "Resource List" TV type just outputs the ids, so I couldn’t have the pagetitle included in the option string and I was trying to get it from within the (grid) rendering function. I’ve resorted to using a standard drop down list TV with a snippet to output the relevant resources in the pagetitle:id format as you suggested.

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