We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18654
    • 191 Posts
    I’m trying to translate this snippet call to a runSnippet call but I’m having problems with the tvFilters parameter. Here is the regular call which works just fine:
    [[getResources? &parents=`38` &tvFilters = 'MediaInfo==Featured' &tpl='listCategoryLinksInner']]
    


    Here is the runSnippet call that I can’t get to work (works fine without the tvFilter option. Also, contains a couple extra parameters not listed above):
    $categoryItems = $modx->runSnippet (
      "getResources" , array(
         "tpl" => "listCategoryLinksInner", 
         "parents"=>"38", 
         "offset"=>"$start", 
         "limit"=>"3",
         "depth"=>"1",
         "sortby"=>"pagetitle",
         "sortdir"=>"ASC"
         ,"tvFilters" => "MediaInfo==Featured"
         ) 
    );
    


    Any ideas on how to pass the tvFilters parameter with a runSnippet call?

    UPDATE

    It was my query that was bad rather than the syntax. I had template variables with multiple checkbox options ("Featured" and "Categories"). The initial line of code:
    "tvFilters"=>"MediaInfo==Featured"
    wasn’t returning any results because both boxes were checked in the resources that the TV’s were tied to. The correct query that is now working is this:
    "tvFilters"=>"MediaInfo==%Featured%"



    I could have sworn I had gotten could results with the normal snippet call previously using "&MediaInfo==Categories" but I guess I must have had some other Snippet returning those results.



    -matt



      God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.