$dbFields[] = "id"; // append id to the db fields array $TVs = array_diff($TVs, $ditto->prefetch["fields"]["tv"]); // calculate the difference between the tv fields and those already prefetched $start = 0; $stop = min($display, $queryLimit != 0 ? $queryLimit : $display, count($documentIDs)); } else { $queryLimit = $queryLimit == 0 ? "" : $queryLimit; } $resource = $ditto->getDocuments($documentIDs, $dbFields, $TVs, $orderBy, $showPublishedOnly, 0, $hidePrivate, $where, $queryLimit, $keywords, $randomize, $dateSource); // retrieves documents $output = $header; // initialize the output variable and send the header if ($resource) { if ($randomize != "0" && $randomize != "1") { $resource = $ditto->weightedRandom($resource, $randomize, $stop); // randomize the documents } $resource = array_values($resource); for ($x = $start; $x < $stop; $x++) { $template = $ditto->template->determine($templates, $x, 0, $stop, $resource[$x]["id"]); // choose the template to use and set the code of that template to the template variable $renderedOutput = $ditto->render($resource[$x], $template, $removeChunk, $dateSource, $dateFormat, $placeholders, $phx, abs($start - $x), $stop); // render the output using the correct template, in the correct format and language $modx->setPlaceholder($dittoID . "item[" . abs($start - $x) . "]", $renderedOutput); /* Placeholder: item[x] Content: Individual items rendered output */