Need code to select using a custom field

CeliaD

Joined: 2009-01-03
Posts: 47
Posted: Tue, 2012-02-28 08:02

I’m using the randimg module to display a random picture in my home page. I would like to be able to select which pictures to show. I created a custom field named “show” with a value of yes or no.

I can’t figure out how to use that to do the selection.

The code to edit is this:

Quote:
class randimg_Core {

static function randimg_link() {

$attempts=0;
do {
$item = item::random_query()->where("type", "!=", "album")->find_all(1)->current();
} while ( !$item && $attempts++ < 5 );

$randimg = new View("randimg.html");
$randimg->item = $item;

return $randimg;

}

}

There, instead of

Quote:
$item = item::random_query()->where("type", "!=", "album")->find_all(1)->current();

I think I need to use the custom field but I don’t know enough to do it myself.

Any ideas?

Thank you,
Celia