$per_page = 9;
$moderation = '';
$lang = 'ru';
include_once($_SERVER['DOCUMENT_ROOT']."/incom/modules/general/mysql.php");
if (isset($_GET["ids"]))
{
$ids=intval($_GET["ids"]);
$s=mysql_query("select `name_block` from i_block where `id`='$ids' limit 1");
$r=mysql_fetch_array($s);
$title = $r["name_block"];
}
else if (isset($_GET["id"]))
{
$id=intval($_GET["id"]);
$s=mysql_query("select cat_name from i_block_elements where id=$id limit 1");
$r=mysql_fetch_array($s);
$title = $r["cat_name"];
}
else if (isset($_GET["new"]))
$title = 'Новинки';
else if (isset($_GET["spec"]))
$title = 'Спец предложения';
else
$title = 'Каталог';
$keywords = '';
$description= '';
# Языковые переменные
$mod_lang_mass = Array(
# Русский
'ru'=>Array(
'no_elements'=>'Извините, в данный момент элементов нет!',
'more'=>'Подробнее...'
),
# Английский
'en'=>Array(
'no_elements'=>'Sorry, no elements found!',
'more'=>'More...'
)
);
require($_SERVER["DOCUMENT_ROOT"]."/incom/template/header.php");
if (isset($_GET['id']) AND (intval($_GET['id']) != '') && (mysql_num_rows(mysql_query("SELECT 'id' FROM `i_block_elements` WHERE `version`='$lang' AND `id`='".intval($_GET['id'])."'")) == 1))
{
$element_id = intval($_GET['id']);
$sql_query = "SELECT * FROM `i_block_elements` WHERE `version`='$lang' AND `id`='$element_id' LIMIT 1";
# Выполняем запрос
$get_element = mysql_query($sql_query);
if (mysql_num_rows($get_element) == 1)
{
$row = mysql_fetch_assoc($get_element);
?>
}
}
else
{
$sql = "";
if (isset($_GET["ids"]) && (intval($_GET['ids']) != '0'))
{
$block_id=intval($_GET['ids']);
//$sql = "`id_section`='$block_id' AND ";
$ids = array($block_id);
$s = mysql_query("SELECT * FROM i_block WHERE id_section='".$block_id."'");
if (mysql_num_rows($s)>0)
{
while($r = mysql_fetch_array($s))
{
$ids[]=$r["id"];
$ss = mysql_query("SELECT * FROM i_block WHERE id_section='".$r["id"]."'");
if (mysql_num_rows($ss)>0)
{
while($rr = mysql_fetch_array($ss))
{
$ids[]=$rr["id"];
}
}
}
}
$sql = "`id_section` in (".join(',',$ids).") AND ";
}
else if (isset($_GET["new"])) $sql = "`cat_nov`='1' AND ";
else if (isset($_GET["spec"])) $sql = "`cat_spec`='1' AND ";
$api->Pages->setvars($lang, $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'], mysql_result(mysql_query("SELECT COUNT('id') FROM `i_block_elements` WHERE ".$sql."`version`='$lang' "), 0), $per_page, @$_GET['p']);
if (!empty($_GET['p'])) {$start=$_GET['p'];} else {$start=1; $_GET["p"]=1;}
$sql_query = "SELECT * FROM `i_block_elements` WHERE ".$sql."`version`='$lang' ORDER BY cat_sort ASC LIMIT ".$api->Pages->start_from.", $per_page";
$get_elements = mysql_query($sql_query);
if (mysql_num_rows($get_elements) != 0)
{
$i=1;
echo '
';
while ($row = mysql_fetch_array($get_elements))
{
$price = (intval($r["cat_price"])!=0 ? number_format(ceil($r["cat_price"]), 0, '', ' ').' тг.' : '');
?>
-
$i++;
}
echo '
';
echo $api->Pages->pages_gen();
}
else { echo '
'.$mod_lang_mass["$lang"]['no_elements'].'
'; }
}
require($_SERVER["DOCUMENT_ROOT"]."/incom/template/footer.php");
?>