Файл: sources/catalog.php
Строк: 70
<?php
if (!defined('VAPHP')) {
die("Этот файл недоступен");
}
class catalog extends base
{
function catalog()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = "{$LNG['main_menu_index']}";
$TMPL['metadescr'] = "{$CONF['cat_descr']}";
$id=1;
$template=array();
$result_cat = $DB->query ("SELECT * FROM {$CONF['sql_prefix']}_cat order by name" , __FILE__, __LINE__);
while($result_cat_fetch=mysql_fetch_array($result_cat))
{
$num_sites = $DB->query("SELECT {$CONF['sql_prefix']}_sites.id FROM {$CONF['sql_prefix']}_sites, {$CONF['sql_prefix']}_subcat WHERE {$CONF['sql_prefix']}_subcat.idcat='{$result_cat_fetch[id]}' and {$CONF['sql_prefix']}_subcat.id={$CONF['sql_prefix']}_sites.idsubcat and {$CONF['sql_prefix']}_sites.visib = '1'", __FILE__, __LINE__);
$num_sites = $DB->num_rows($num_sites);
$template[$id].=<<<EndHTML
<h3><a href="{$CONF['site_url']}/cat/{$result_cat_fetch[id]}">{$result_cat_fetch[name]}</a> [{$num_sites}]</h3>
<div class="content"><ul>
EndHTML;
$result_subcat = $DB->query ("SELECT * FROM {$CONF['sql_prefix']}_subcat where idcat={$result_cat_fetch[id]} order by name" , __FILE__, __LINE__);
while($result_subcat_fetch=mysql_fetch_array($result_subcat))
{
$template[$id].=<<<EndHTML
<li><a href="{$CONF['site_url']}/subcat/{$result_subcat_fetch[id]}">{$result_subcat_fetch[name]}</a></li>
EndHTML;
}
$template[$id].=<<<EndHTML
</ul></div>
EndHTML;
$id++;
}
$TMPL['content']=<<<EndHTML
<center>
<table cellspacing="10" id="mainTable" align="center" border=0>
<tr valign=top>
<td>
EndHTML;
for($i==1; $i<=count($template); $i++)
{
$TMPL['content'].=$template[$i];
if(($i % $CONF['num_cols_on_index'])==0 and $i!=0 and $i!=count($template))
{
$TMPL['content'].=<<<EndHTML
</td>
</tr>
<tr valign=top>
<td>
EndHTML;
}
elseif(($i % $CONF['num_cols_on_index'])!=0 and $i>0 and $i!=count($template))
{
$TMPL['content'].=<<<EndHTML
</td>
<td>
EndHTML;
}
}
$TMPL['content'].=<<<EndHTML
</td>
</tr>
</table>
</center>
EndHTML;
if (!isset($TMPL['content'])) { $TMPL['content'] = ''; }
}
}
?>