We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36760
    • 136 Posts
    I'm using MODX Revolution 2.5.1-pl and MIGX 2.9.6-pl.

    I have a migxLoopCollection where I'm trying to only display items if their name matches one of the names in a list of names. I've tried both in_array and find_in_set. I believe find_in_set is what I want, but it's not displaying anything. Below is my snippet:

    [[!migxLoopCollection? &packageName=`TVPackages` &classname=`TVPackages` &tpl=`TVPackagesVSingleTpl` &where=`{"name:find_in_set":"Select,Starter"}`]]


    I've also tried a snippet found in another thread, but it didn't make a difference.

    <?php
    //findInSet
    if (!is_array($subject)) {
        $subject = explode(',',str_replace('||',',',$subject));
    }
     
    return (in_array($operand,$subject));


    My snippet then looked like this:
    [[!migxLoopCollection? &packageName=`databaseTVPackages` &classname=`databaseTVPackages` &tpl=`TVPackagesVSingleTpl` &where=`{"name:snippet:findInSet":"Select,Starter"}`]]


    Am I misunderstanding how find_in_set is supposed to work? If so, is there a way to accomplish what I'm looking to do? I've successfully used in_array with an array of IDs in the past, but that isn't an option here.

    Thanks for the help! [ed. note: firebot6 last edited this post 7 years, 5 months ago.]