You are here

function ed_classified_get_latest_ads_list in Classified Ads 5.2

Same name and namespace in other branches
  1. 5 ed_classified_utils.inc \ed_classified_get_latest_ads_list()
  2. 6.2 ed_classified_utils.inc \ed_classified_get_latest_ads_list()
  3. 7.2 ed_classified_utils.inc \ed_classified_get_latest_ads_list()

Get a list of latest ads for block use

1 call to ed_classified_get_latest_ads_list()
ed_classified_block in ./ed_classified.module
Implementation of hook_block().

File

./ed_classified_utils.inc, line 217
Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…

Code

function ed_classified_get_latest_ads_list() {

  // Show recent nodes, but only if they haven't expired
  $q = db_query_range(db_rewrite_sql("SELECT n.title, n.nid, n.created AS timestamp, n.changed FROM {node} AS n, {edi_classified_nodes} AS ec WHERE n.type = \\'ed_classified\\' AND n.status = 1 AND n.nid = ec.nid AND n.vid = ec.vid AND ec.expires_on > '%d' ORDER BY n.created,n.title, n.nid DESC", 'n', 'nid', REQUEST_TIME), 0, _ed_classified_variable_get('block_latest_limit', 4));
  return theme('ed_classified_ads_block', _ed_classified_query_results_to_array($q), TRUE, FALSE, TRUE);
}