• Ditto - YAMS returning "No documnets found"#

  • GrafitoStudio Reply #1, 6 months, 1 week ago

    Reply
    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?


  • sottwell Reply #2, 6 months, 1 week ago

    Reply
    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


  • GrafitoStudio Reply #3, 6 months, 1 week ago

    Reply
    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.


  • GrafitoStudio Reply #4, 6 months, 1 week ago

    Reply
    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!


  • sottwell Reply #5, 6 months, 1 week ago

    Reply
    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!



  • GrafitoStudio Reply #6, 6 months, 1 week ago

    Reply
    Quote from: sottwell at Nov 16, 2011, 11:48 PM

    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.