function hook_simpleads_order in SimpleAds 7
Build SQL Query to order SimpleAds in blocks.
Parameters
string $delta:
array $term_ids:
int $limit:
Return value
type
1 function implements hook_simpleads_order()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- simpleads_simpleads_order in ./
simpleads.module - Implements hook_simpleads_order().
1 invocation of hook_simpleads_order()
- _simpleads_load_ads in includes/
simpleads.helper.inc - Helper function. Returns data array for an adertisement block.
File
- ./
simpleads.api.php, line 25 - SimpleAds API.
Code
function hook_simpleads_order($delta, $term_ids, $limit) {
if ($delta == 'delta_1') {
$query = db_select('node', 'n');
$query
->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
$query
->fields('n', array(
'nid',
));
$query
->condition('n.type', 'simpleads');
$query
->condition('n.status', 1);
$query
->condition('ti.tid', $term_ids, 'IN');
$query
->orderRandom();
$query
->range(0, $limit);
return $query
->execute();
}
}