catalog.php
<?php
if (empty($page)) {
$page = 0;
}
require("./NewsSql.inc.php");
$db = new NewsSQL($DBName);
$catalogname = $db->getcatalognamebyid($catalogid);
$cataresult = $db->getchildcatalog($catalogid);
$catanewsresult = $db->getnewsbycatid($page,$front_latestoncatarecord,$catalogid);
?>
<html>
<head>
<title><?php print "$catalogname"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php print "$front_charset"; ?>">
<link rel="stylesheet" href="./style/style.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFDF" text="#000000" leftmargin="0" topmargin="0">
<td class="menu" bgcolor="#FFFFFF" valign="top" width="410">
<tr>
<td>
<?php
if (!empty($catanewsresult)) {
while ( list($key,$val)=each($catanewsresult) ) {
$title = stripslashes($val["title"]);
$newsid = stripslashes($val["newsid"]);
print "<a href=\"news.php?newsid=$newsid\" class=\"en_b\"><img src=\"./images/bullet_b.gif\" width=\"11\" height=\"9\" border=\"0\">$title</a><br>";
}
}
?>
</td>
</tr>
<tr>
<td align="right">
<?php
$pagenext = $page+1;
$result1 = $db->getnewsbycatid($pagenext,$front_latestoncatarecord,$catalogid);
if ($page!=0)
{
$pagepre = $page-1;
print "<a href=\"$PHP_SELF?page=$pagepre&catalogid=$catalogid\" class=\"en_b\">$front_previouspage</a> ";
}
if (!empty($result1))
{
print "<a href=\"$PHP_SELF?page=$pagenext&catalogid=$catalogid\" class=\"en_b\">$front_nextpage</a>";
}
?>
</td>
</tr>
<?php
if (!empty($cataresult)) {
while ( list($key,$val)=each($cataresult) ) {
$catalogname = stripslashes($val["catalogname"]);
$catalogid = stripslashes($val["catalogid"]);
$result = $db->getnewsbycatid(0,$front_catnewsoncatarecord,$catalogid);
?>
<tr>
<td colspan="2">
<?php
if (!empty($result)) {
while ( list($key,$val)=each($result) ) {
$title = stripslashes($val["title"]);
$newsid = stripslashes($val["newsid"]);
?>
<a href="news.php?newsid=<?php print "$newsid"; ?>" class="en_b"><img src="./images/bullet_b.gif" width="11" height="9" border="0"><?php print "$title"; ?></a><br>
<?php
}
}
?>
</td>
</tr>
<?php
}
}
?>
</body>
</html>
Buda fonksiyon
<?
function kat_goster_dunya()
{
echo '
<fieldset><legend>dünyada olan bitenler</legend>
';
$kat_sorgu = mysql_query("select * from haberler where kategori='dunyadan' order by haber_id desc limit 5");
if(mysql_num_rows($kat_sorgu) == 0)
{ // eğer her hangi bir sonuç çıkmazsa..
echo '
henüz bu kategoride haber yok..
';
echo '
</fieldset>
';
}
else
{
while($list = mysql_fetch_array($kat_sorgu))
{
echo '-->
<a href="haberler.php?haber='.$list['haber_id'].'">
'.$list['haber_adi'].'
</a><br>
';
}
echo '
</fieldset>
';
}
}
?>
Fonksiyonu catalog.php ye göre düzenlersem sorun çözilcek ama düzenleyemedim tam olarak