We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29618
    • 5 Posts

    Hi at all,

    i’m just in developing a new modx page and sticking auf 2 little problems.

    1. i’m using getResource to display contntent from 3 different resources - at the moment i can only use one chunk for alle of the resources. it is possible to give every resource its own chunk.

    • resource id 2 --> chunk 1
    • resource id 5 --> chunk 2
    • resource id 9 --> chunk 3

    2. i want to create a calendar, wich displays the events in a row sorted by the date (tv). All old dates should be automaticly sorted out. So i use the where condition. But it seems not to work with the date tv.

    I hope you can give me some advice to do this things in an elegant way smiley

    Thanks so much


      • 29597 ☆ A M B ☆
      • 350 Posts
      To use TV with getResources you need (this will get all children of document with ID5):

      [[!getResources? &parents=`5` &tpl=`myRowTpl` &includeTVs=`1` &processTVs=`1` &tvPrefix=``]]

      and
      Dont forget the myRowTpl chunk template...

      Call the TV in the template with:
      [[+my_tv]]


      see
      http://rtfm.modx.com/display/ADDON/getResources
        MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
        DESIGNfromWITHIN, MPThemes and Any Screen Size
        Follow me on Twitter | Read my blog | My code on GitHub
        • 29618
        • 5 Posts
        Hi, thanks for your answer,

        i think here is a misunderstanding smiley

        My first problem:
        i have this call:

        [[!getResources? &parents=`1,8` &showHidden=`true` &tpl=`030_CHK_MVB_ARTICLE_LST` &includeTVs=`1` &processTVs=`1` ]]

        Resource 1 is for general news article on the main page -> the template for this is 030_CHK_MVB_ARTICLE_LST
        Resource 2 is for publishing new events from an other resource -> for this i need a different chunk because it has different content to the previous.


        The 2nd problem:

        this call:

        [[!getResources? &parents=`8` &showHidden=`true` &tpl=`060_CHK_CALENDAR` &includeTVs=`1` &processTVs=`1` & sortbyTV =`010_KAL_DATE` &sortdirTV=`asc` &where=`010_KAL_DATE>=time()` ]]

        Here i want to show only all resources where the tv 010_KAL_DATE is bigger than the actual time.


        I hope it’s now a bit clearer what i mean smiley

        Thanks so much smiley
          • 3749
          • 24,544 Posts
          The only way I know of to associate a particular Tpl chunk with a record is to use &tpl_1, &tpl_2 (it might be &tpl_{1}, &tpl_{2} -- I haven’t used it). You’d have to know ahead of time where those records would fall. If that doesn’t work for you, you’d have to write your own snippet to get and process the records (which would be faster anyway).

          Try taking out &processTVs. Processing the date TVs will give a date string, which may not sort properly and won’t compare properly to time(). You may need to use an output modifier if you want to also display the dates.
            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
            • 29618
            • 5 Posts
            Thanks for your help.

            Got the 2nd thing solved by creating a new output filter, which returns the unixtime instead of the date string.

            Best wishes smiley