<?php
$months = $modx->resource->getMany('Children');
if (!empty($months)) {
sort($months);
foreach ($months as $month) {
$output .= "\n<li>";
$output .= "\n<div class='title'>\n<h5>" . $month->get('pagetitle') . "</h5>\n</div>";
$output .= "<div class='content'>";
$fixtures = $month->getMany('Children');
if (empty($fixtures)) {
$output .= "<p>No Fixtures</p>";
} else {
$output .= "<table>";
$output .= "<thead>";
$output .= "<tr>";
$output .= "<th>Start</th>";
$output .= "<th>End</th>";
$output .= "<th>Fixture</th>";
$output .= "<th>Venue</th>";
$output .= "</tr>";
$output .= "</thead>";
foreach ($fixtures as $fixture) {
$templateVars =& $fixture->getMany('TemplateVars');
foreach ($templateVars as $tvId => $templateVar) {
$tvs[$templateVar->get('name')] = $templateVar->get('value');
}
$resourceArray = array_merge($fixture->toArray(),$tvs);
$output .= $modx->getChunk('FixtureTpl', $resourceArray);
}
$output .= "</table>";
}
$output .= "\n</div>";
$output .= "\n</li>";
}
}
return $output;This question has been answered by Bruno17. See the first response.
$c = $modx->newQuery('modResource');
$c->sortby('menuindex');
$months = $modx->resource->getMany('Children',$c);$c = $modx->newQuery('modResource');
$c->sortby('menuindex');
$months = $modx->resource->getMany('Children',$c);
if (!empty($months)) {
foreach ($months as $month) {
$output .= "\n<li>";
$output .= "\n<div class='title'>\n<h5>" . $month->get('pagetitle') . "</h5>\n</div>";
$output .= "<div class='content'>";
$c = $modx->newQuery('modResource');
$c->sortby('menuindex');
$fixtures = $month->getMany('Children',$c);
if (empty($fixtures)) {
$output .= "<p>No Fixtures</p>";
} else {
$output .= "<table>";
$output .= "<thead>";
$output .= "<tr>";
$output .= "<th>Start</th>";
$output .= "<th>End</th>";
$output .= "<th>Fixture</th>";
$output .= "<th>Venue</th>";
$output .= "</tr>";
$output .= "</thead>";
foreach ($fixtures as $fixture) {
$templateVars =& $fixture->getMany('TemplateVars');
foreach ($templateVars as $tvId => $templateVar) {
$tvs[$templateVar->get('name')] = $templateVar->get('value');
}
$resourceArray = array_merge($fixture->toArray(),$tvs);
$output .= $modx->getChunk('FixtureTpl', $resourceArray);
}
$output .= "</table>";
}
$output .= "\n</div>";
$output .= "\n</li>";
}
}
return $output;