Location: PHPKode > scripts > Create Your Own Directory > cms/functions/content.php
<html>
<?php
	include "../header.php";
?>

<script language=javascript>
var idd="";
var home;
var parentnam="",parentidd;
</script>

<?php 
    
      global $sno;
      $y="";
    	$url=$_SERVER['REQUEST_URI'];
    	$pos=strrpos($url,'-');
    	 $urll = substr($url, 0, $pos);
    	$id1=$_GET['id'];
    	$name=$_GET['name'];
    	if($sno=="")
	 $sno=0;
    	$start = $_GET['start'];
    	if($start == "")
		$start = 0;
      echo "<script language='javascript'>\n";
      echo "idd = \"$id1\";";
      echo "home = \"$home\";";
       echo "name= \"$name\";";
      echo "</script>"; 
	echo"<title>$name</title>";
	$name= str_replace("_", " ", "$name");
	//echo"$name--$cntid";
	
	$match=$_GET['match'];
	$alg=$_POST['algo'];
      //echo"$alg";
	$sub=$_POST['sub'];
	$order=$_POST['order'];

	
?>
<script language=javascript>
var parentnamarr=name+"/";
var parentarr= new Array();
var parentnam=new Array();
var parentnam1=new Array();

var nam="";
while(idd>0)
{
nam=getParent(idd);

if(nam)
{
parentarr=nam.split("::");
parentnamarr=parentnamarr+parentarr[1]+"/";
idd=parentarr[2];
}else
{
idd=0;
}
}

parentnam=parentnamarr.split("/");
//parentnam1=parentnam.pop();
var ct = parentnam.length;
var vaal ="";
parentnam=parentnam.reverse();
document.write("<div style='margin-left:20px;'>");
for(var dd=0; dd<ct-1; dd++)
{
  vaal = parentnam[dd];

  document.write("<a href='");
  for(var fff=dd+2; fff<ct; fff++)
	  document.write("../");

  document.write("index.html'>"+vaal+"</a> :: ");
}

var vaal = parentnam[ct-1];
document.write("<A HREF=''>"+vaal+"</a> </div>");

</script>

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

<br><div align=right style='padding-right:20px; font-size: 13px;'><form name=frm method=post>
   Sorting Order 
   <select name=algo>
    <?php
	$sel= array("default::Default","A.rateval::Rated","cnt.view::Visited","cnt.contents::Alphabet order","cnt.adddate::Added Date");
      foreach( $sel as $namea ){
		$s = explode("::",$namea);
		if($alg == $s[0])
			echo  "<option value='".$s[0]."' selected>".$s[1]."</option>";
		else
			echo  "<option value='".$s[0]."'>".$s[1]."</option>";
      }
     	echo"</select>";
     	echo"<input type=hidden name=sel value='$algo'></input>";
	echo"<input type=hidden name=sub value='yes'></input>";

	if($typ[8]=="updated")
      {
		echo"<input type=image name=order SRC=".$home."includes/print.php?cnt=".$id[8]." value=\" asc\" ></input>";
  		
     	}else{
		echo"<input type=image name=order SRC=".$home."image/img8.gif value=\" asc\"></input>";
	}

	if($typ[9]=="updated")
      {
		echo"<input type=image name=order SRC=".$home."includes/print.php?cnt=".$id[9]." value=\" desc\" ></input>";
	}else{
		echo"<input type=image name=order SRC=".$home."image/img9.gif value=\" desc\"></input>";
	}
	echo"</form>";
    ?>
</div>

<?php
$i=0;
$st="select fname,contentpg from cntfields where catid=$id1";
$res=mysql_query($st);
while($rr= @mysql_fetch_array($res,MYSQL_ASSOC))
{
  $fname[$i]=$rr['fname'];
  $contentpg[$i]=$rr['contentpg'];
$i++;
}
if(($sub=='yes')&& ($alg != 'default'))
  {
$str1="select cntid,contents, UserName, view, coalesce(rateval,0)as rateval, coalesce(referral,0)as referral
from cnt left join (SELECT rid, sum(rateval) as rateval,dat from rating group by rid) A ON (cnt.cntid = A.rid) 
left join (select crid,sum(referral)  as    referral,refdate from referral  group by crid) C on (cnt.cntid=C.crid)
left join (select  UserName,UserId from user )D on (cnt.usrid=D.UserId)   
where cnt.tid=$id1 and status like 'REV' order by $alg $order limit $start,5 ";

  }else{
    $str1="SELECT cntid ,UserName, contents, rateval,referral, view, ratcnt,
    CASE 
  	WHEN (-((30-( DATEDIFF(CURDATE(),adddate)))) < 30) then ((30-(DATEDIFF(CURDATE(),adddate)))*1000)
    	WHEN ((-(30-( DATEDIFF(CURDATE(),adddate))))>30)&&(coalesce(ratcnt,0)>=2) then (((coalesce(rateval,0)/5)*coalesce(view,0))+coalesce(view,0)+coalesce(referral,0))
      WHEN ((-(30-( DATEDIFF(CURDATE(),adddate))))>30)&&(coalesce(ratcnt,0)<2) then ((coalesce(view,0)*.06)+coalesce(view,0)+coalesce(referral,0))
      END AS policy 
      from cnt left join (SELECT rid, sum(rateval) as rateval , dat,count(rateval) as ratcnt
      from rating group by rid) A ON (cnt.cntid = A.rid) left join
      (select crid,sum(referral) as referral,refdate from referral  group by crid)
      C on (cnt.cntid=C.crid) left join (select  UserName,UserID from user )D on (cnt.usrid=D.UserId) where cnt.tid=$id1 and status like 'REV'
      order by policy desc limit $start,5 ";
 }	

//echo $str1;
$res1=mysql_query($str1);
$pr="";
    $sno = $sno+$start;
while($rr= mysql_fetch_array($res1,MYSQL_ASSOC))
{
$contents=$rr['contents'];
$cntid=$rr['cntid'];
$UserName=$rr['UserName'];
$view=$rr['view'];
$arr=split('####',$contents);
 
     $y="<table border=0 align=center width=90% cellpadding=0 cellspacing=0 valign=top style='border: 1px solid lightblue; background-color: #ffffff;'>";
	if($typ[18]=="updated"){
	    		$y=$y."<tr width=100%><td width=16% align=left background=".$home."includes/print.php?cnt=".$id[18]." width=".$uwidth[18]." height=".$uheight[18]." border=0 >&nbsp;&nbsp;&nbsp;<a href='$arr[0]-$cntid.html' class=cathead>$arr[0]</a></td><td width=16% align=right background=".$home."includes/print.php?cnt=".$id[18]." width=".$width[18]." height=".$height[18]." border=0 >Views: $view</span></td></tr>";
		}else{
	   		$y=$y."<tr ><td width=16% align=left background=".$home."image/img18.gif  width=".$width[18]." height=".$height[18]." border=0 width=16%>&nbsp;&nbsp;&nbsp;<a href='$arr[0]-$cntid.html' class=cathead>$arr[0]</a></td><td width=16% align=right background=".$home."image/img18.gif  width=".$width[18]." height=".$height[18]." border=0 width=16%>Views: $view</span></td></tr>";
      	}


	  

for($j=1;$j<count($arr);$j++)
{
if($contentpg[$j]==1)
{
$tmp=$tmp."<tr><td ><div style='padding: 5px 15px;' align=left >$fname[$j]</div></td><td colspan=2><div style='padding: 5px 15px;' align=left >$arr[$j]</div></td></tr>";
}
}

	$pr=$pr.$y.$tmp."<tr bgcolor=#eeeeee><td style=\"padding: 5px 15px; \" >Date: $adddate </td><td><div align=right style=\"padding-right:20px;\"> Added by:$UserName</div></tr></table><br>";
	$sno = $sno+1;
 $y="";
$tmp="";

}
?>
<td></tr><tr><td style="font-size: 14px; padding: 10px;" valign=top align=right>
<?php
$start1=$start+5;
$start2=$start-5;
$url1=$urll."-".$start1.".php";
$url2=$urll."-".$start2.".php";

echo"<div align=right style='margin-right:10px;'>";
  if($sno > 5)
{

if($typ[21]=="updated")
      	{
$str1="<a href=\"$url2\" style='text-decoration:none'><image style='border:0;' SRC=".$home."includes/print.php?cnt=".$id[21]."></a>";

      		
      	}else{
$str1="<a href=\"$url2\" style='text-decoration:none'><image style='border:0;' SRC=".$home."image/img21.gif></a>";

      		
   		}



echo"$str1";
}
echo"	&nbsp;"; 
if($sno == ($start+5)){

if($typ[20]=="updated")
      	{
$str2="<a href=\"$url1\" style='text-decoration:none'><image style='border:0;' SRC=".$home."includes/print.php?cnt=".$id[20]."></a>";

      		
      	}else{
$str2="<a href=\"$url1\" style='text-decoration:none'><image style='border:0;' SRC=".$home."image/img20.gif></a>";

      		
   		}

echo"$str2";
}
echo"</div><br>";
echo"$pr";

 if($sno > 5)
{
echo"$str1";
}
echo"	&nbsp;"; 
if($sno == ($start+5)){
echo"$str2";
}
echo"</div>";

?>

<script language=javascript>
document.write("<div align=left style='margin-left:20px;'>");
for(var dd=0; dd<ct-1; dd++)
{
  var vaal = parentnam[dd];
  document.write("<a href='");
  for(var fff=dd+2; fff<ct; fff++)
	  document.write("../");
  document.write("index.html'>"+vaal+"</a> :: ");

}
var vaal = parentnam[ct-1];
document.write("<A HREF=''>"+vaal+"</a> </div><br>");
</script>

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

Return current item: Create Your Own Directory