hvala puno si mi pomogo.. sad ne znam koliko je pametno pisati u istu temu ali imam sad problem koji sam ne znam rijesiti :S
da prvo pojasnim o cemu se radi, pravim web-biznis direktoriji i sad donekle sam ja to nes i zavrsio naso par skripti pa to kombiniram sad i ispo mi je problem u tomu kad nemogu da stavim ispod direktorija tj njegovog naziva u naslovnoj opis, koji sam naravno unjeo kad sam dodavo kategoriju to sad trenutno izgleda ovako...
Test(2) Gllupost(1) Proba(4)
... ... ...
borojevi u zagradama oznacavaju koliko se nalazi u tim kategorijama unosa i ispod su podkadtegorije te tri tackice (...) ali ja necu da pisu pod kategorije vec da pise opis kategorija.. uglavnom evo kod od mog viewdir.php pa ako moze neko da pogleda i da mi objasni sta treba da samo zamjenim znam da trebam samo zamijeniti nesto ali ne mogu ga naci :S
Code:
<?
if (!eregi("index.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$index = 1;
include("header.php");
global $prefix, $link,$banner;
$cid=getvarint("cid");
//$findtot=mysql_query("select * from yp_list where cid=$cid", $link);
//$totallist=mysql_num_rows($findtot);
// This cause some problem
$sql=mysql_query("SELECT count(yp_list.listid) AS total, count(yp_cat.cid) as totalcat FROM yp_list LEFT JOIN yp_cat ON yp_list.cid = yp_cat.cid WHERE yp_list.cid =yp_cat.cid AND yp_cat.parentid='$cid' or yp_cat.cid ='$cid' AND active='1'",$link) or die("Error".mysql_error());
list($totallist,$totalcat)=mysql_fetch_row($sql);
$result = mysql_query("select title,parentid from yp_cat where cid=$cid", $link);
list($title,$parentid)=mysql_fetch_row($result);
$title=getparentlink($parentid,$title);
//openTable();
//echo"<tr><td align=center>$banner</td></tr>";
//closeTable();
//echo"<br>";
//update hits
@mysql_query("UPDATE ".$prefix."_cat SET hits=hits+1 WHERE cid=$cid",$link);
echo"<div align=\"center\">
<center>
<table cellpadding=\"5\" border=\"0\" width=\"750\">
<tr align=\"center\">
<td valign=\"middle\" align=\"left\">
<p align=\"left\"><b>:: <a href=index.php>Početna</a> <strong><big>»</big></strong> $title($totallist)</b></td>
</tr>
<tr align=\"center\">
<td align=\"center\">";
//working on it
$resulta=@mysql_query("select listname FROM ".$prefix."_list JOIN ".$prefix."_cat ON ".$prefix."_list.cid= ".$prefix."_cat.cid WHERE ".$prefix."_cat.cid='$cid' AND active='1'",$link);
while($al=@mysql_fetch_array($resulta)){
$alphalist[]=strtolower(substr("$al[listname]",0,1));
}
echo"<table align=center>";
echo"<tr><td><a href=\"index.php?file=viewdir&cid=$cid\"><b>Sve</b></a> ";
foreach($alpha as $value){
if(is_array($alphalist) && in_array(strtolower($value),$alphalist)){
echo"<a href=\"index.php?file=viewdir&cid=$cid&startwith=$value\"><b>$value</b></a> ";
}else{
echo"$value ";
}
}
echo"</td></tr>";
echo"</table>";
closeTable();
echo"<hr noshade=\"noshade\" color=\"#ff9933\" size=\"1\"></td>
</tr>
</table>
</center>
</div>";
$result2 = mysql_query("SELECT yp_cat.cid,title, count(listid) as totallist FROM yp_cat LEFT JOIN yp_list ON yp_list.cid = yp_cat.cid WHERE parentid = $cid AND active='1' GROUP BY yp_cat.cid", $link) or die("Error".mysql_error());
$count = 1;
$csub=mysql_num_rows($result2);
echo"<div align=\"center\">";
echo"<table border=\"0\" width=80%>";
echo"<tr>";
while($row=@mysql_fetch_array($result2)){
echo"<td width=\"5%\"> </td><td><a href=\"index.php?file=viewdir&cid=$row[cid]\">$row[title]</a>($row[totallist])</td><td width=\"5%\"> </td>";
if($count==3){
echo"</tr></tr>";
$count=0;
}
$count++;
}
echo"</tr>";
echo"</table>";
echo"</div>";
closeTable();
if(isset($_GET["startwith"])){
$startwith=addslashes($_GET["startwith"]);
}else{
$startwith="";
}
if(!empty($_GET["startwith"])){
$con= "substring(listname FROM 1 FOR 1) LIKE '%$startwith%' AND";
}else{
$con="";
}
$query="select listid,cid,listname,description FROM ".$prefix."_list where $con cid=$cid AND active='1'";
$resultc=mysql_query("$query", $link) or die("Error".mysql_error());
$num_record = mysql_num_rows($resultc);
if($num_record<1){
openTable();
echo"<center>"._YPNORECORDFOUND."</center>";
closeTable();
include("footer.php");
exit;
}
if(isset($_GET['page']))
$page=intval($_GET['page']);
else $page=1;
$currentpage=$page;
$perpage =10;
$start=($page-1) * $perpage;
$pages=ceil($num_record/$perpage);
$starting_no = $start + 1;
if ($num_record - $start<$perpage) {
$end_count = $num_record;
} elseif ($num_record - $start >= $perpage) {
$end_count = $start + $perpage;
}
if($pages>1)
$page_link = makepagelink("index.php?file=viewdir&cid=$cid&startwith=$startwith", $page, $pages);
else
$page_link = "";
$result=@mysql_query("select listid,cid,phone,listname,description,city,country,website from yp_list where $con cid=$cid limit $start,$perpage", $link);
if($num_record>0){
echo"<div align=\"center\">";
echo"<table cellSpacing=0 cellPadding=0 width=75% border=0>
<tr>
<td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
</tr>
<tr>
<td vAlign=top align=left>
<p align=left>Prikazano » :
$starting_no-$end_count od $num_record unosa » Stranica $currentpage</td>
<td width=20> </td>
<td vAlign=top align=right>
<p align=right>";
echo"$page_link";
echo"</td>
</tr>
<tr>
<td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
</tr>
</table>";
echo"</div>";
echo "<div align=center>
<center>
<table cellPadding=5 width=75% border=0>
<tr>
<td vAlign=top align=right width=7% bgColor=#ffd966>
<strong>Broj.</strong></td>
<td vAlign=top align=left width=45% bgColor=#ffd966>
<strong>Organizacija </strong></td>
<td vAlign=top align=left width=25% bgColor=#ffd966 >
<strong>Grad</strong></td>
<td vAlign=top align=left width=15% bgColor=#ffd966>
<strong>Država</strong></td>
<td vAlign=top align=middle width=8% bgColor=#ffd966 >
<strong>Web stranica</strong></td>
</tr>
</table>
</center>
</div>";
$num=$starting_no-1;
while(list($listid,$cid,$phone,$listname,$description,$city,$country,$website)=mysql_fetch_row($result)) {
$title = stripslashes($title);
$description = stripslashes($description);
$num++;
if($website="<a href=\"$website\" target=\"_blank\"><img alt=\"Posjetite $listname web stranicu\" src=\"images/homepage.gif\" border=\"0\" width=19 height=19></a>";
}
}
if(strlen($phone)<3){
$phone="";
}else{
$phone="($phone)";
}
$country=country($country);
echo"<div align=center>
<center>
<table cellPadding=5 width=75% border=0>
<tr>
<td vAlign=top align=right width=7% bgColor=#ffe699>
$num</td>
<td vAlign=top align=left width=45% bgColor=#ffe699>
<a href=\"index.php?file=details&listid=$listid&cid=$cid\">
$listname</a> <br>$phone</td>
<td vAlign=top align=left width=25% bgColor=#ffe699>
$city</td>
<td vAlign=top align=left width=15% bgColor=#ffe699>
$country</td>
<td vAlign=top align=middle width=8% bgColor=#ffe699>$website</td>
</tr>
</table>
</center>
</div>";
echo"<br>";
if($num_record>0){
echo"<div align=\"center\">";
echo"<table cellSpacing=0 cellPadding=0 width=75% border=0>
<tr>
<td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
</tr>
<tr>
<td vAlign=top align=left>
<p align=left>Prikazano » :
$starting_no-$end_count od $num_record unosa » Strana $currentpage</td>
<td width=20> </td>
<td vAlign=top align=right>
<p align=right>";
echo"<a href=#top>Vrh</a> $page_link";
echo"</td>
</tr>
<tr>
<td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
</tr>
</table>";
echo"</div>";
}
include("footer.php");
?>