We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41294
    • 34 Posts
    Are there any other TPLs for getRelated? like on getResources with the following below:


    • tpl_nN
    • tplOdd
    • tplFirst
    • tplLast

    Also is [[+count]] placeholder same with the [[+idx]] of getResoures?


    Thanks smiley
    • Don't think so, but those would be great feature feature requests on the github issues tracker.

      [[+count]] is an option in the wrapper tpl, not the individual rows, so no.
        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.
        • 3749
        • 24,544 Posts
        Quote from: markh at Jul 30, 2013, 10:43 PM

        I would love to include a multilingual preg_replace that just works, but simply don't have the experience with countries/languages that use non-latin characters to know all the valid characters. Would you happen to have a preg_replace that just works that you can send over in a pull request on github?

        Have you tried using it with the /U (unicode) modifier?
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 36613
          • 328 Posts
          I want order my related post by publishedon date. However i do this:
          [[!getRelated?
           &fields=`tv.tags:3`
           &returnFields=`pagetitle,menutitle,longtitle,introtext,publishedon`
           &parents=`6`
           &limit=`3`
           &tplOuter=`tag_result_approfondimenti_outerTpl`
           &tplRow=`tag_result_approfondimenti`
           &noResults=`Nessun approfondimento trovato`
           &fieldSort=`publishedon`
           &fieldSortDir=`desc`
           &tvSample=`50`
           &debug=`0`
           ]]


          but doesn't work.
          • Hi Cristian,

            From the documentation:

            Resource field to sort by in collecting the sample, used in conjunction with the fieldSample propert. (Does not sort the related resources output, only the sample used in determining related resources!)

            It only affects the sample; getRelated automatically sorts based on the the calculated rank for each result. The fieldSort property is useful when you have a really large set of resources with a lot of matches and you run into the sample limit.

            If you just want to show recent posts with a certain tag, use getResourcesTag (part of the TagLister extra).
              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.
            • Hi all in this thread! How to unsubscribe from it? Thanks
              • Stop Email link at the top:


                  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.
                  • 42639
                  • 9 Posts
                  Hi, sorry for reactivating an older thread, but it seemed more logical to place the query here than start a new one.

                  How do I get an image stored as a MigX TV to display in my RowTpl? Currently It's unable to find the image url, alt text and title.

                  This is my getrelated call:
                  [[getRelated?
                      &limit=`3`
                      &parents=`303`
                      &fields=`pagetitle:10,tv.article_tags:7,introtext:5`
                      &tplOuter=`RCI.RelatedOuter`
                      &tplRow=`RCI.RelatedRow`
                      &returnTVs=`Image,Alt,Caption`
                      ]]


                  And this is my RCI.RelatedRow:

                  <li>
                  
                  <div class="related-image">
                  <a href="[[~[[+id]]]]"><img src="[[+Image:phpthumbof=`w=200&h=134&zc=1`]]" alt="[[+Alt]]" title="[[+Caption]]" /></a>
                  </div>
                  
                  <div class="related-text">
                  <a href="[[~[[+id]]]]">[[+longtitle:default=`[[+pagetitle]]`]]</a>
                  
                  </div>
                  
                   </li>


                  I'm guessing I need to run a getResources call to get the info for the Tvs that getRelated needs first, but how exactly do I incorporate this into RowTpl? I am having a bit of blank moment here (been a looooong day!)
                  • Hi neiltipton!

                    You'll need to add the MIGX tv to your returnTVs property on the getRelated snippet first. I'm guessing Image, Alt and Caption are the fields within MIGX, however you'll need to grab the actual MIGX TV - not the fields within.

                    With that info, you can then use the MIGX included getImageList snippet to loop over the items in MIGX (if you just want the first, I think it accepts a &limit property) and output the image url.
                      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.
                      • 42639
                      • 9 Posts
                      Quote from: markh at Jan 11, 2015, 11:01 PM
                      Hi neiltipton!

                      You'll need to add the MIGX tv to your returnTVs property on the getRelated snippet first. I'm guessing Image, Alt and Caption are the fields within MIGX, however you'll need to grab the actual MIGX TV - not the fields within.

                      With that info, you can then use the MIGX included getImageList snippet to loop over the items in MIGX (if you just want the first, I think it accepts a &limit property) and output the image url.

                      Thanks Mark - I'll bear this in mind for the future. In the end, I realised I was overcomplicating things by using MigX in this instance - I ended up creating the fields with individual tvs and it works as anticipated and is probably more fit-for-purpose anyway. Great snippet nonetheless - I can't imagine how much time I would have spent trying to replicate something similar without it!