Hi im trying to get this snippet to work:
Set up as instructed:
Container Documnet id=88
documents inside - 0,1,2,3
Call
[!ClientQuote? "eid=`88`!]
Snippet:
<?php
// RandomQuote
// Snippet to produce by sottwell.
// Posted by web_designer.
// Dated 25th Sepember 2006.
$resourceparent = $quoteid; // the folder that contains quote documents
$output = ’’; // initialise the quote variable
$resource = $modx->getActiveChildren($resourceparent,’createdon’, ’DESC’, $fields=’content’); // get array of children
$limit=count($resource); // count how many in the array
if($limit<1) {
$output .= "No entries found.
";
return $output;
}
$random = (rand(1, $limit) - 1); // make a random number between 1 and $limit, subtract 1 to allow for array counting from 0 not 1
$output .= $resource[$random][’content’]; // grab a random document’s content from the $resource array
return $output;
?>
?>
Page where implemented
http://www.icwebdesign.co.uk/new
Any ideas why ’No entries found’ is displayed?