Location: PHPKode > projects > Esvon Personals > esvon-personals/inc/pages/list.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/
//
// --------------------------------------------------------------------------

if(!defined('SITE_PATH')) die('Access Denied');

$DISP_ROWS = 50;
//$EN_ROW_BLOCKS = false; // experimental

$uid = abs((int)$_GET['uid']);
if(!$uid){
  header('Location: index.php');
  exit;
}

$cid = abs((int)$_GET['cid']);

$ql = 'SELECT COUNT(*) FROM '.TBL_AD.' WHERE userid="'.$uid.'"'.hwFilterGetSQL();
if($cid) $ql.=" AND catid='$cid'";

$numrecs = $db->one_data($ql);

/*
$ql = str_replace('COUNT(*)',hwSQLFieldsGet().',catid',$ql);
$ql.=' ORDER BY catid,'.$TITLE_FIELD;
*/

//$ql = $EN_ROW_BLOCKS ? '*' : hwSQLFieldsGet(true);
$ql = 'SELECT '.hwSQLFieldsGet(true).',l.catid FROM '.TBL_AD.' l, '.TBL_CAT.' c WHERE l.userid="'.$uid.'"'.hwFilterGetSQL('l.').' AND c.id=l.catid';
if($cid) $ql.=" AND l.catid='$cid'";
$ql.=' ORDER BY c.weight DESC, c.name';

//nav stuff starts
$off = (ctype_digit($_GET['off']) && $_SERVER['REQUEST_METHOD']=='GET') ? $_GET['off'] : 0;
$number = $off * $DISP_ROWS;

$ql.=" LIMIT $number,".$DISP_ROWS;
$res = $db->query($ql);

/*
if($EN_ROW_BLOCKS){
  $tpl = Factory::create('Row_Block_Tpl',
    array(
      'tpl_f' => TPL_PATH.'list.htm',
      //'tpl_id' => 'row',
      //'cell_id' => 'item',
    )
  );
}
else */

$tpl = new HawkTpl;
 
$tpl->InitArray('row');

$catid = -1;
$z = array();
  
while($v = mysql_fetch_assoc($res)){
  if($catid!=$v['catid']){
    $catid = $v['catid'];
    $z['cname'] = GetCatPathCached($catid);
    $tpl->AddCell('row',$z,'cat');
  }
  $tpl->AddCell('row',hwSQLRowGet($v),'item');
}

$O_UFS = &Factory::singleton('FieldsSet', '{user_fields}');

$tpl_v = $db->one_assoc('SELECT * FROM '.TBL_USER." WHERE id='$uid'");
$tpl_v = $O_UFS->FillCustomFieldsArray($tpl_v, true);
$O_UFS->AdjustCustomFields($tpl_v);

$tpl_v['uid'] = $uid;
$tpl_v['numrecs'] = $numrecs;
$tpl_v['nav'] = GetNavigation($_SERVER['PHP_SELF'],$DISP_ROWS,10,$numrecs,$off,"&page=list&uid=$uid");

//$tpl->parseMaxVarsInCell = true;
$tpl->Parse(TPL_PATH.'list.htm', $tpl_v, 1);

?>
Return current item: Esvon Personals