<?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/
//
// --------------------------------------------------------------------------
if(!defined('SITE_PATH')) die('Access Denied');
$DISP_ROWS = 20;
$off = (ctype_digit($_GET['off']) && $_SERVER['REQUEST_METHOD']=='GET') ? $_GET['off'] : 0;
$num = $off*$DISP_ROWS;
$ql = 'SELECT COUNT(*) FROM '.TBL_AD.' WHERE hw_feat="1"'.hwFilterGetSQL();
$numrecs = $db->one_data($ql);
/*
$ql = str_replace('COUNT(*)',hwSQLFieldsGet().',catid',$ql);
$ql.=' ORDER BY catid,'.$TITLE_FIELD;
*/
$ql = 'SELECT '.hwSQLFieldsGet().',l.catid FROM '.TBL_AD.' l, '.TBL_CAT.' c WHERE l.hw_feat="1"'.hwFilterGetSQL('l.').' AND c.id=l.catid';
$ql.=' ORDER BY c.weight DESC, c.name';
$ql.=" LIMIT $num,".$DISP_ROWS;
$res = $db->query($ql);
$tpl = new HawkTpl;
$tpl->InitArray('row');
$catid = -1;
$z_c = array();
while($v = mysql_fetch_assoc($res)){
if($catid != $v['catid']){
$catid = $v['catid'];
$z_c['cname'] = GetCatPathCached($catid);
$tpl->AddCell('row',$z_c,'cat');
}
$tpl->AddCell('row', hwSQLRowGet($v), 'item');
}
$nav = GetNavigation($_SERVER['PHP_SELF'],$DISP_ROWS,10,$numrecs,$off,"&page=featured");
//nav stuff ends
$pg_now = $off + 1;
$pg_max = ceil($numrecs / $DISP_ROWS);
$tpl->Parse(TPL_PATH.'featured.htm','$numrecs,$pg_now,$pg_max,$nav',1);
?>