45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
<?php
|
|
if($settings['cachePage']>0){
|
|
if(!@$_SESSION['user_id']) { /* если не авторизован - кешируем */
|
|
$smarty->caching = false;
|
|
$smarty->cache_lifetime = $settings['cachePage'];//минута
|
|
}
|
|
}
|
|
//Получаем новинки
|
|
unset($a);
|
|
$a['public']=1;
|
|
$db -> or_by_desc = 1;
|
|
//$newtovar=$db->get_massiv('m_tovar',$a, 'id',30);
|
|
$newtovar=$db->free_sql('SELECT * FROM `m_tovar` WHERE `img` <> "" LIMIT 30');
|
|
//print_r($newtovar);
|
|
$smarty -> assign( 'newtovar', $newtovar );
|
|
unset($a);
|
|
$count = $db -> count_sql('m_tovar', $a);
|
|
for($i = 0; $i < 40; $i++){
|
|
$rand = rand(0, $count);
|
|
$rnd_tovar=$db->free_sql('SELECT * FROM `m_tovar` WHERE `img` <> "" LIMIT ' . $rand . ', 1');
|
|
$rtovar[$i]=$rnd_tovar;
|
|
//$rtovar2[$i]=$rtovar[$i];
|
|
}
|
|
//echo( $rnd_tovar[0]['naim']);
|
|
//print_r($rtovar);
|
|
$rt=Array();
|
|
$count=count($rtovar);
|
|
//echo $count;
|
|
for($i=0; $i<$count; $i++){
|
|
if ($rtovar[$i][0])$rt[$i]=$rtovar[$i][0];
|
|
}
|
|
$smarty -> assign( 'rnd_tovar', $rt );
|
|
//$rt2 = array_values($rt, array(''));
|
|
//print_r($rt);
|
|
/*
|
|
print_r($rnd_tovar);
|
|
print_r($rnd_tovar[0]);
|
|
$t=$rnd_tovar;
|
|
echo $t[0]['id'];
|
|
*/
|
|
//получаем последние страницы:
|
|
unset($a);
|
|
$db -> or_by_desc = 1;
|
|
$smarty -> assign( 'last_page', $db->get_massiv('pages', $a, 'id', 4) );
|
|
?> |