Location: PHPKode > scripts > Create Your Own Directory > cms/functions/category.php
<html>
<?php
include "../header.php";
?>
<?php
$name=$_GET['name'];
$titlename = str_replace("/", " , ", "$name");
$titlename = str_replace("_", " ", "$titlename");

echo"<title></title>";
$sstr=explode('/',$name);

function parid($name1,$sstr)
{
$len=count($sstr);
$len1=$len-1;
$len2=$len-2;
  if($len > 1)
  {
   $qry="select b.id as childid , b.name as child from type a left join type b ON (a.id = b.parentid)  where a.name like '$sstr[$len2]' and b.name like '$sstr[$len1]'";
  }else
  {
   $qry="select id as childid from type where name like '$sstr[$len1]'";
  }
  $result= mysql_query($qry);
  if($row1=mysql_fetch_array($result,MYSQL_ASSOC))
  {
   $idd=$row1['childid'];
  }
  return $idd;
}

  $iddd=parid($name,$sstr);


  echo "&nbsp; &nbsp; ";
  $ll = count($sstr);
echo"<div style='margin-left:20px;'>";

  for($dd=0; $dd<$ll; $dd++)
  {
	$vaal = $sstr[$dd];
	echo " <a href='";
	for($fff=$dd+1; $fff<$ll; $fff++)
		echo "../";
	echo "index.html'>$vaal</a> :: ";
  }
 echo "</div>";

  echo "<div align=right valign=top style='text-decoration:none;padding-right:20px;'><a href=\"$home/HRAS/users/addcontent.php\" style='text-decoration: none; color:black;'><strong>[ADD NEW LISTING]</strong></a></div>";

 //parid($name);
  $name = str_replace("_", " ", "$name");
  $str="select count(*) as childs,a.id as childid,a.name as name,a.des as des,a.parentid as id, b.name as ccname ,b.id as cchildid,b.parentid from type as a left join   
  type as b on (a.id=b.parentid) where a.id IN (select d.id from type as c, type as d where 
  c.id=d.parentid && c.id=$iddd)  group by a.name order by childs desc";
  //echo "$str";
  $result = mysql_query($str);
  echo "<table border=0 width=100% align=center>";
  $xx=0;
  while($row = @mysql_fetch_array($result, MYSQL_ASSOC)){
    $iddd=$row['childid'];
    $parent = $row['parent'];
    $name=$row['name'];
    $name1 = str_replace(" ", "_", "$name");
    $description=$row['des'];
    $cchildid=$row['cchildid'];
    //echo"---$id -- pa$name1 --c$child"; 
    $xx=$xx+1;
    if(($xx%2)!= 0){					
        if($cchildid == ""){
          echo"<tr><td valign=top width=50%><table width=100% border=0 >";
            
  		if($typ[7]=="updated")
      	{

      		echo"<tr><td width=100%><img src=".$home."includes/print.php?cnt=".$id[7]." width=".$uwidth[7]." height=".$uheight[7]." border=0 ><a class=cathead href='$name1-$iddd-0.php'> $name ( )</a></td></tr> ";
      	}else{
      		echo"<tr><td width=100%><img src=".$home."image/img7.gif  width=".$width[7]." height=".$height[7]." border=0 ><a class=cathead href='$name1-$iddd-0.php'> $name ( )</a></td></tr>";   
   		}
	


          

	    echo"<tr><td align=justify  height=30 style='padding-left:50px;background-color:#ffffff; color:#58595b;  font-size: 12px; font-family: arial,verdana, san-serif; '>$description </td></tr></table></td>";
	  }else{    
	    echo"<tr><td><table width=100% border=0 >";
if($typ[7]=="updated")
      	{

      		echo"<tr><td width=100%><img src=".$home."includes/print.php?cnt=".$id[7]." width=".$uwidth[7]." height=".$uheight[7]." border=0 ><a class=cathead href='$name1/index.html'> $name ( )</a></td></tr> ";

      	}else{
      		echo"<tr><td width=100%><img src=".$home."image/img7.gif  width=".$width[7]." height=".$height[7]." border=0 ><a class=cathead href='$name1/index.html'> $name ( )</a></td></tr> ";

   		}

	    echo"<tr><td align=justify  height=30 style='padding-left:50px;background-color:#ffffff; color:#58595b;   font-size: 12px; font-family: arial,verdana, san-serif; '>$description </td></tr></table></td>";
	  }
    }else{
        if(!($cchildid)){
	    echo"<td valign=top width=50% ><table width=100% border=0 >";


if($typ[7]=="updated")
      	{

      		echo"<tr><td width=100%><img src=".$home."includes/print.php?cnt=".$id[7]." width=".$uwidth[7]." height=".$uheight[7]." border=0 ><a class=cathead href='$name1-$iddd-0.php'> $name ( )</a></td></tr> ";

      	}else{
      		echo"<tr><td width=100%><img src=".$home."image/img7.gif  width=".$width[7]." height=".$height[7]." border=0 ><a class=cathead href='$name1-$iddd-0.php'> $name ( )</a></td></tr> ";

   		}
	   
	    echo"<tr><td height=30 align=justify  style='padding-left:50px;background-color:#ffffff; font-size: 12px;color:#58595b;  font-family: arial,verdana, san-serif; '>$description </td></tr></table></td></tr><tr><td height=10></td></tr>";					
	  }else{
	   echo"<td><table width=100% border=0 >";


if($typ[7]=="updated")
      	{

      		echo"<tr><td width=100%><img src=".$home."includes/print.php?cnt=".$id[7]." width=".$uwidth[7]." height=".$uheight[7]." border=0 ><a class=cathead href='$name1/index.html'> $name ( )</a></td></tr> ";

      	}else{
      		echo"<tr><td width=100%><img src=".$home."image/img7.gif  width=".$width[7]." height=".$height[7]." border=0 ><a class=cathead href='$name1/index.html'> $name ( )</a></td></tr> ";

   		}


	  

	   echo"<tr><td height=30 color=#efefef align=justify  style='padding-left:50px;background-color:#ffffff; font-size: 12px; color:#58595b; font-family: arial,verdana, san-serif; '>$description </td></tr></table></td></tr><tr><td height=10></td></tr>";

	  }
     }
  }
echo "</table>";

?>
<?php
echo"<div style='margin-left:20px;'>";

  for($dd=0; $dd<$ll; $dd++)
  {
	$vaal = $sstr[$dd];
	echo " <a href='";
	for($fff=$dd+1; $fff<$ll; $fff++)
		echo "../";
	echo "index.html'>$vaal</a> :: ";
  }
 echo "</div>";

?>
<?php
include '../footer.php';
?>








Return current item: Create Your Own Directory