New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • Can’t seem to figure out how to make my TV as the sort by in a custom snippet. Any help would be greatly appreciated.

    $tvIdOne = 14;
    $tvIdTwo = 28;
    
    $c = $modx->newQuery('modResource');
    $c->where(array(
       'parent:IN' => array(56,57,58,59,60,61,62,63),
       'deleted' => false,
       'hidemenu' => false,
       'published' => true,
    ));
    /////// HELP! ///////
    $tvSort = $modx->resource->getTVValue($tvIdTwo);
    $c->sortby($tvSort,'ASC');
    /////// HELP! ///////
    $c->limit(40);
    $resources = $modx->getCollection('modResource',$c);
    
    $output = '';
    $output .= '<div>';
    foreach ($resources as $resource) {
    	$tvValue = $resource->getTVValue($tvIdOne);
    	$tvSort = $resource->getTVValue($tvIdTwo);
    	if($tvValue =="none"){
    		} else {
    		$input = $tvValue;
    		$width = 220;
    		$height= 220;
    		$options = "w=$width&h=$height"; 
    		$thumbnail = $modx->runSnippet("phpthumbof",array('input' => $input, 'options' => $options));
    		$output .= '<p>'.$tvSort.'</p><div class="thumb"><a title="'.$resource->get('pagetitle').'" href="'.$modx->makeUrl($resource->get('id')).'"><img alt="'.$resource->get('pagetitle').'" src="'.$thumbnail.'" height="142" width="220" /></a></div>';
    	}
    }
    $output .= '<br clear="all" /></div>';
    return $output;
    • Hello,

      did you find the solution? I trying to do the same thing with no result either sad

      cheers