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

// --------------------------------------------------------------------------
//
// Esvon Classifieds v.4.0
// Copyright(C), Esvon LLC, 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 links (category specific)

function block_Related_Links(&$tpl, $args = ''){

  $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_Links';
  $cache = &Factory::singleton('Hw_Cache');
  $a_v = $cache->get($block_id.'_'.$cid,$block_id.'_Get_Data('.$cid.')');
  if($a_v){
     $tpl->AddCell($block_id,'','start');
     //foreach($a_v as $v) $tpl->AddCell($block_id,$v,'row');
     
     $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_Links_Get_Data($cid){
global $db;

   $a_v = array();
   $res = $db->query ('SELECT title AS rel_title,url,target FROM '.TBL_REL_LINK.' where catid="'.$cid.'" ORDER BY title');
   while($v = mysql_fetch_assoc($res)){
     if(!$v['target']) $v['target'] = '_self';
     $a_v[] = $v;
   }
   return $a_v;

}

?>
Return current item: Esvon Personals