We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41127
    • 23 Posts
    I guess the title says it all. How do i get all the TV's from a category? I hoped it would be something like:
    $modx->resource->getTemplateVarCollection(array('id' => 6));
    id being the category id. but that is not it. Anyone?
      • 22427
      • 793 Posts
      Try this:
      $modx->resource->getCollection('TemplateVars', array('id'=>'6'));
        • 3548
        • 102 Posts
        $criteria = $modx->newQuery('modTemplateVar');
        $criteria->where(array(
            'category' => $categoryId,
        ));
        $tvs = $modx->getCollection('modTemplateVar',$criteria);
        foreach ($tvs as $tv) {
            //do seomething with each TV
        }
        
          Antonio Zdilar
          linearvector.com
          • 41127
          • 23 Posts
          awesome, thanks guys. Not tried yet but with this info i must get it working!