I would like to randomly display images from Acidfree albums on my homepage in a php snippet.
This is what I've got so far:
This is supposed to load 3 random images.
$where = "class != 'album' ORDER BY RAND()";
$query = "SELECT aid FROM {acidfree} WHERE $where LIMIT 3";
$result = db_query($query);
$nodes = Array();
while ($row = db_fetch_object($result)) {
$nodes[] = acidfree_get_node_by_id($row->aid);
}
return $nodes;
foreach ($nodes as $node) {
$output .= "<div class='random-image'>";
$output .= theme("acidfree_print_thumb_{$node->class}", $node);
$output .= "</div>";
}
return $output;
What I get is:
This is supposed to load 3 random images.
Array
I'm guessing the key component is {acidfree} in the query line, but I'm not sure. Any ideas how to make this work?
Thanks!
PS. I took the code from this portion of the acidfree.module:
<?php
function acidfree_get_block_nodes($where, $count) {
$query = "SELECT aid FROM {acidfree} WHERE $where LIMIT $count";
$result = db_query($query);
$nodes = Array();
while ($row = db_fetch_object($result)) {
$nodes[] = acidfree_get_node_by_id($row->aid);
}
return $nodes;
}
function acidfree_block_contents($where, $count) {
$nodes = acidfree_get_block_nodes($where, $count);
foreach ($nodes as $node) {