$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 */ $output .= $renderedOutput; // send the rendered output to the buffer } } else { $output .= $ditto->noResults($noResults, $paginate); // if no documents are found return a no documents found string }