Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/list_categories.php
<?php
	/*******************************************************************************
     **  File          :  list_categories.php                                     **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  left navigation menus and themes   					  **
  	 **  Date          :  14/07/2005                                              **
     **  Last Modified :  02/08/2005                                              **
     **  PHP Version   :  5.0.3                                                   **
     **                                                                           **
     *******************************************************************************/
if(empty($_REQUEST['lang']) && $_COOKIE["LANGUAGE"]=="")
   $lang='en';
elseif($_REQUEST['lang']!="")
   $lang=$_REQUEST['lang'];
else
  $lang=$_COOKIE["LANGUAGE"];


$cat_id=$_REQUEST['cat_id'];
$catQry="select * from category where language='$lang' and type='T' and category_status!='y' order by category_name asc";
$cat_res=$pg_sql->query_pass($catQry,"4");


?>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td valign="middle" height="20" width="159" class="bgblue1">&nbsp;</td></tr>
<?
$cnt=count($cat_res);

for($i=0;$i<count($cat_res);$i++)
{
  if($cat_res[$i][category_id] == $cat_id)
  {
    $subcatQry="select * from subcategory where category_id=$cat_id";
    $subcat_res=$pg_sql->query_pass($subcatQry,"4");

     if($_REQUEST['subcat_id']=="")
        $class="active";
     else
         $class="heading3";

?>

		<tr>
		   <td valign="Top" height="20" width="159" class="bgblue1"><a href="index.php?cat_id=<?=$cat_res[$i][category_id]?>&lang=<?=$lang?>" class="<?=$class?>"><?=ucfirst($cat_res[$i][category_name])?></a></td>
		</tr>
<?
    for($j=0;$j<count($subcat_res);$j++)
    {
    	if($_REQUEST['subcat_id']==$subcat_res[$j][subcategory_id])
		   $subclass="active";
		else
		   $subclass="menutitlesub";

 ?>
 	    <tr>
             <td  valign="Top" height="20" width="159" class="bgblue1">&nbsp;<a href="index.php?cat_id=<?=$cat_res[$i][category_id]?>&subcat_id=<?=$subcat_res[$j][subcategory_id]?>&lang=<?=$lang?>" class="<?=$subclass?>">&nbsp;<?=ucfirst($subcat_res[$j][subcategory_name])?></a></td>
	    </tr>
<?
    }
  }
  else
  {
?> 	  <tr>
	     <td  valign="Top" height="20" width="159" class="bgblue1"><a href="index.php?cat_id=<?=$cat_res[$i][category_id]?>&lang=<?=$lang?>" class="heading3"><?=ucfirst($cat_res[$i][category_name])?></a></td>
	 </tr>
<?
  }
}
?>
<tr>
      <td valign="Top" height="1" bgcolor="<?=$bottom_cat_style?>"></td>
  </tr>
<?
  $lt_qry="select * from menus where position='left' and language='$lang' order by version asc";
  $lt_res=$pg_sql->query_pass($lt_qry,"4");


      for($y=0;$y<count($lt_res);$y++)
      {


	          $id=$lt_res[$y]['menu_id'];
	          $desc=trim($lt_res[$y]['description']);
	          $ext=pathinfo($lt_res[$y]['image']);
	          $path=$ext['extension'];

	          $dir="login/menu_images/".$id.".".$path;
	          if(file_exists($dir))
	          {
	             $view=getimagesize($dir);
	  		     preg_match('/(width\=\")(.*?)(\")/i',$view[3],$match);
	  		    if($match[2]<50){
	  		      $image='&nbsp;&nbsp;<img src="'.$dir.'" border="0" width="120" height="60" alt="'.trim($lt_res[$y][alt_image]).'">';
	  		      $class="head3";
	  		      $align="left";
	  		    }
	  		   else{
	  		      $image='<br>&nbsp;&nbsp;<img src="'.$dir.'" width="120" height="60" border="0" alt="'.trim($lt_res[$y][alt_image]).'">';

	  		      if(trim($lt_res[$y]['menu_name'])!="")
	  		         $class="heading3";
	  		       else
	  		          $class="";
	  		      $align="center";
	  	       }

	          }else{
	                $image=="";
	                $class="head3";
	  		        $align="left";
	          }
             if(strstr($lt_res[$y]['url'],"list_channels") || strstr($lt_res[$y]['url'],"list_tags"))
			 {
                 $ch_lang='?lang='.$lang;
	         }else{
			     $ch_lang="";
			}
?>
<tr align="left">
 	 <td  valign="middle" height="35" class="bgyellow"><a href="<?=$lt_res[$y]['url'].$ch_lang?>" class="<?=$heading3new?>"  title="<?=trim($lt_res[$y]['menu_name'])?>"><?=trim($lt_res[$y]['menu_name'])?></a>
 	 <?if(isset($image))
	 	        echo '<a href="'.$lt_res[$y]['url'].'" class="'.$class.'" target="_new">'.$image."</a>";
	 	     if($desc!=""){?>
	 	      <br><br><font class='cont'><?=$desc?></font>
	     <?}?>
 	 </td>
</tr>
<?unset($image);
 }?>

 <tr>
      <td valign="middle" height="100%" width="159" bgcolor="<?=$bottom_bgcolor_style?>">&nbsp;</td>
  </tr>
</table>
Return current item: News Manager - RSS aggregator