$url = $modx->makeUrl($doc->get('id'), "", "", "full");$output .= '<h2><strong><a href="' . $url . '">' . $resource->get('pagetitle') . '</a></strong></h2>' . $resource->get('content');<?php
$tvId = 30; /* change this to the ID of the category TV */
function getDocs($category, $tvId) {
global $modx;
$tvrs = $modx->getCollection('modTemplateVarResource', array(
'tmplvarid' => $tvId,
'value' => $category
));
$docs = array();
foreach ($tvrs as $tvr) {
$docs[] = $tvr->get('contentid');
}
$c = $modx->newQuery('modResource');
$c->where(
array('id:in' => $docs)
);
$c->sortby('menuindex', 'ASC');
$resources = $modx->getCollection('modResource', $c);
$url = $modx->makeUrl($doc->get('id'), "", "", "full");
$output = '<div class="someclasses"><div class="someclasses2"><p>' . $category . '</p>';
foreach ($resources as $resource) {
/*start formatting output */
$output .= '<h2><strong><a href="' . $url . '">' . $resource->get('pagetitle') . '</a></strong></h2>' . $resource->get('content');
/*end formatting output */
}
$output .= '</div></div>';
return $output;
}
/* Get all possible categories */
$c = $modx->newQuery('modTemplateVarResource');
$c->distinct();
$c->where(array('tmplvarid' => $tvId));
$tvrs = $modx->getCollection('modTemplateVarResource', $c);
$output = '';
/* Get the resources in each category */
$usedCategories = array();
foreach ($tvrs as $tvr) {
$category = $tvr->get('value');
if (! in_array($category, $usedCategories)) {
$usedCategories[] = $category;
$output .= getDocs($category, $tvId);
}
}
return $output;Fatal error: Call to a member function get() on a non-object in C:\wamp\www\nestnew\ore\cache\includes\elements\modsnippet\46.include.cache.php on line 28
$url = $modx->makeUrl($resource->get('id'), "", "", "full");$c->sortby('menuindex', 'ASC');