Location: PHPKode > projects > Esvon Personals > esvon-personals/inc/blocks/block-Random_Ad.php
<?php

// --------------------------------------------------------------------------
//
// Esvon Classifieds v.4.0
// Copyright(C), Esvon LTD, 2001-2010, All Rights Reserved.
// E-mail: hide@address.com
//
// All forms of reproduction, including, but not limited to, internet posting, 
// printing, e-mailing, faxing and recording are strictly prohibited.
// One license required per site running Esvon Classifieds. 
// To obtain a license for using Esvon Classifieds, please register at
// http://www.esvon.com/pg/products/p_classifieds/
//
// --------------------------------------------------------------------------

// Random listing(s)

function block_Random_Ad(&$tpl, $args = ''){
global $TITLE_FIELD;
static $a_id;

    $amt = isset($args['amount']) ? abs(intval($args['amount'])) : 1;

    if(!isset($a_id)) $a_id = array();

    $ql = "SELECT ".hwSQLFieldsGet()." FROM ".TBL_AD." WHERE 1".hwFilterGetSQL();

    if($a_id) $ql.=' AND link_id NOT IN('.implode(',',$a_id).')';
    $ql.=' ORDER BY RAND() LIMIT 0,'.$amt;

    $a_v = $GLOBALS['db']->select($ql);
    $num = 0;
    foreach($a_v as $v){
      $a_id[] = $v['f_id'];
      $v['num'] = ++$num;
      $tpl->AddCell('b_Random_Ad', hwSQLRowGet($v));
    }

}

?>
Return current item: Esvon Personals