{php}
$tpl_path = "/themes/def_xn";
$user=DB_SERVER_USERNAME;
$pass=DB_SERVER_PASSWORD;
$db=DB_DATABASE;
$link=mysql_connect(DB_SERVER, $user, $pass);
if (!$link) { die("Ошибка подключения к серверу MySQL<br>ERROR ".mysql_errno()." - ".mysql_error()."\n"); }
mysql_select_db($db, $link) or die("Ошибка доступа к базе MySQL");
$res = mysql_query("SELECT os_categories.categories_id, os_categories_description.categories_id, categories_name, categories_description, sort_order, parent_id FROM os_categories, os_categories_description WHERE os_categories.categories_status='1' AND os_categories.categories_id=os_categories_description.categories_id AND parent_id='0' ORDER BY sort_order asc LIMIT 0,8;"); // $f[categories_image]
echo "<table width='100%'>";
for ($w=0; $w<(mysql_num_rows($res)/4); $w++)
{echo "\n<tr>";
for ($c=0; $c<(mysql_num_rows($res)/2); $c++)
{ $f = mysql_fetch_array($res);
echo "\n<td class='main' valign='top'>
<table width='175'><tr>
<td class='contents' valign='middle' align='center'>
<strong><a href='index.php?cat=$f[categories_id]'>$f[categories_name]</a></strong>
</td>
</tr>
<tr>
<td class='contents' valign='top' align='center'>
<a href='index.php?cat=$f[categories_id]'><<img src='images/categories/$f[categories_id].jpg' alt='$f[categories_name]' title='$f[categories_name]' /></a>
</td>
</tr>
<tr>
<td class='contents' valign='top' align='left'>";
$res2 = mysql_query("SELECT * FROM os_categories, os_categories_description WHERE os_categories.categories_id=os_categories_description.categories_id AND parent_id='$f[categories_id]' ORDER BY sort_order asc LIMIT 0,10;");
for ($e=0; $e<mysql_num_rows($res2); $e++)
{ $f2 = mysql_fetch_array($res2);
echo "<li class='CatLevel1'><a href='index.php?cat=$f2[categories_id]'>$f2[categories_name]</a></li> ";
}
echo "\n</td>
</td>
</tr>
<tr>
<td class='contents' width='100%' valign='top' height='100%' >";
//echo "\n$f[categories_description]<br /><br />";
echo "\n<a href='index.php?cat=$f[categories_id]'>Далее...</a><br />";
echo "\n</td>
</tr>
</table>
</td>";
}
echo "\n</tr> ";
}
echo "\n</table>";
{/php}