Location: PHPKode > projects > Esvon Personals > esvon-personals/inc/blocks/block-Related_Categories.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/
//
// --------------------------------------------------------------------------

// Related categories (category specific)

function block_Related_Categories(&$tpl){

  $COL_NUM = isset($args['cols']) ? abs((int)$args['cols']) : 1;
  
  if($_REQUEST['cid']) $cid = (int)$_REQUEST['cid'];
  elseif($_REQUEST['cat']) $cid = (int)$_REQUEST['cat'];
  else $cid = 0;
  
  $block_id = 'b_Related_Categories';

  $cache = &Factory::singleton('Hw_Cache');
  $a_v = $cache->get($block_id.'_'.$cid, $block_id.'_Get_Data('.$cid.')', TRUE);
  
  if($a_v){
     
     $tpl->AddCell($block_id,'','start');

     $cur_i = 0;
     foreach($a_v as $v) {
       $tpl->AddCell($block_id,$v,'row');
       $cur_i++;
       if($cur_i>=$COL_NUM){
         $cur_i=0;
         $tpl->AddCell($block_id,'','br');
       }
     }
     while($cur_i<$COL_NUM){
       $tpl->AddCell($block_id,'','blank');
       $cur_i++;
     }
     $tpl->AddCell($block_id,'','end');

  }

}

function b_Related_Categories_Get_Data($cid){
global $db;

   $a_v = array();
   $v = array();
   $res = $db->query('SELECT id FROM '.TBL_REL_CAT.' WHERE related_id="'.$cid.'"');
   while(list($id) = mysql_fetch_row($res)) {
//     if(!EN_ZERO_CAT && !$o_cat->AMT[$id]) continue;
     $v['r_cat'] = GetCatPathCached($id,1);
     $a_v[] = $v;
   }
   return $a_v;

}

?>
Return current item: Esvon Personals