We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34954
    • 12 Posts
    I have a multilingual site done with YAMS and I want to show "featured" articles on the front page.

    Thus I have created a template variable called featured and made the following ditto call:

    [!Ditto? &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &filter=`tvFeatured,'Yes',8` &debug=`1` &debug=`1` &id=`(yams_id)` &language=`(yams_mname) !]


    but I get "no documents found"

    If i try:
    [!Ditto? !]


    i equally get "no documents found"

    Out of despair, I have introduced the following calls (not quite a millions monkeys trying to design a website!)
    [!Ditto? &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &filter=`tvFeatured,'Yes',7` &debug=`1` &id=`(yams_id)` &language=`(yams_mname) !]
    [!Ditto? &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &filter=`tvFeatured,'Yes',8` &debug=`1` &debug=`1` &id=`(yams_id)` &language=`(yams_mname) !]
    [!Ditto? &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &filter=`tvFeatured,'Yes',2` &debug=`1` &id=`(yams_id)` &language=`(yams_mname) !]
    [!Ditto? &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`  &filter=`tvFeatured,'Yes',1` &debug=`1` &id=`(yams_id)` &language=`(yams_mname) !]
    [!Ditto? !]
    
    


    And I don't get anything, the debug output can be found there:
    http://host.quksdns8.net/%7Elondoned/revo/home

    I am running out of ideas and suspect I have done a beginner mistake but can't find it. Can somebody help me?
    • Where are the resources that you want to list? Are they children of the resource containing the Ditto call? You really should use a parameter &parents=`x` to specify the parent of the resources you want to list, even if the parent is the one with the Ditto call.

      You can further control which resources to list with the &documents parameter, and filter out specified resources using &filter.

      I've attached a handy cheat-sheet that I often refer to. There is also the excellent Ditto documentation at Pogwatch http://www.pogwatch.com/ditto.html
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 34954
        • 12 Posts
        Thank you for the quick reply, that helped me. I am not there yet but think that as soon as I get a bit more time on my hands, I will be fine as the results sound sensible (to me!) now.

        For the record, I now use &parents=`0` &depth=`0` which tells Modx to look in all documents.
          • 34954
          • 12 Posts
          I've finally sorted out my problem.

          I think that there is a mistake on the pohwatch website. For the filtering, it says

          1:not equal
          2: equal

          In fact I think it should be the other way round. I couldn't find an email to warn the author.


          Edit: See below, I was mistaken! [ed. note: GrafitoStudio last edited this post 12 years, 5 months ago.]
          • According to all the documentation I can find, it is correct.

            http://ditto.modxcms.com/files/snippet-ditto-php.html#filter

            Remember, the &filter parameter causes matching items to be removed!

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 34954
              • 12 Posts
              Quote from: sottwell at Nov 17, 2011, 05:48 AM


              Remember, the &filter parameter causes matching items to be removed!


              Indeed! I was thinking "filtering in" rather than "filtering out", was puzzled and found out only by experimenting. OK I think that I get it now. Thanks again for your help.