'Все', 1=>'Грузовые А/М', 2=>'Легкогрузовые А/М', 3=>'Леговые А/М', 4=>'С/Х и Спецтехника'); $tp=array(1=>'Шины', 2=>'Диски', 3=>'Камеры', 4=>'Ободные ленты'); include('get_main_html.php'); $db_tables=array(1=>'cat_shini',2=>'cat_diski',3=>'cat_cams',4=>'cat_lenti'); $cat_arr=array(1=>'photos_shini',2=>'photos_diski',3=>'no_path',4=>'no_path'); $db_fields[1]=array('id','tt','code','speed_ind','weight_ind','manuf','model','country','width','height','diametr','type','apply','category','cost','dsc'); $db_fields[2]=array('id','tt','code','manuf','country','width','diametr','et','holes','center','cost'); $db_fields[3]=array('id','tt','code','size','vent','country','apply','cost'); $db_fields[4]=array('id','tt','code','size','country','apply','cost'); $patterns=array(1=>'cat_shini.htm',2=>'cat_diski.htm',3=>'cat_cams.htm',4=>'cat_lenti.htm'); $bg_styles=array(false=>'bg',true=>'bg2'); // ШИНЫ if($p==1){ $content.='Товар: '.$tp[1].'
Тип транспорта: '.$tt[$t].'
'; $list_obj->table_name=$db_tables[1]; $list_obj->fields_list=$db_fields[1]; $list_obj->additional_query_part=''; if($t!=0){ $list_obj->additional_query_part.='WHERE `tt` = '.$t; } if($m!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`manuf` LIKE \'%'.mysql_real_escape_string($m).'%\''; $content.='Производитель: '.htmlspecialchars($m).'
'; } // учесть при поиске размеры if(($w!='')||($h!='')||($dr!='')){ $content.='Размер: '.htmlspecialchars($w.'/'.$h.$dr).'
'; if($w!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`width` LIKE \'%'.mysql_real_escape_string($w).'%\''; } if($h!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`height` = \''.mysql_real_escape_string($h).'\''; } if($dr!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`diametr` = \''.mysql_real_escape_string($dr).'\''; } } // сезонность if(($sum==1)or($win==1)){ $content.='Сезон: '; if($sum==1){$content.='лето';} if($win==1){ if($sum==1){$content.=', ';} $content.='зима'; } $content.=''; if(($sum==1)and($win==0)){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`category` NOT LIKE \'%зим%\''; } if(($sum==0)and($win==1)){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`category` NOT LIKE \'%лет%\''; } } $content.='
'; $list_obj->get_list(); $list_obj->fields_list[]='bg_style'; $list_obj->fields_list[]='link'; foreach($list_obj->list_arr as $n=>$v){ $list_obj->list_arr[$n]['bg_style']=$bg_styles[($n/2)==round($n/2)]; if(is_file($cat_arr[1].'/'.$v['id'].'_1.jpg')){ $list_obj->list_arr[$n]['link']=$cat_arr[1].'/'.$v['id'].'_1.jpg'; }else{ $list_obj->list_arr[$n]['link']='#'; } } $pat=file_get_contents('html/'.$patterns[1]); //$content.=file_get_contents('html/cat.htm'); //$cat=$list_obj->show_all_list($pat); //$content=str_replace('%catalog%',$cat,$content); } // ДИСКИ if($p==2){ $content.='Товар: '.$tp[2].'
Тип транспорта: '.$tt[$t].'
'; $list_obj->table_name=$db_tables[2]; $list_obj->fields_list=$db_fields[2]; $list_obj->additional_query_part=''; if($t!=0){ $list_obj->additional_query_part.='WHERE `tt` = '.$t; } if($m!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`manuf` LIKE \'%'.mysql_real_escape_string($m).'%\''; $content.='Производитель: '.htmlspecialchars($m).'
'; } // учесть при поиске размеры /*if(($w!='')||($h!='')||($dr!='')){ $content.='Размер: '.htmlspecialchars($w.'/'.$h.$dr).'
'; if($w!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`width` LIKE \'%'.mysql_real_escape_string($w).'%\''; } if($h!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`height` = \''.mysql_real_escape_string($h).'\''; } if($dr!=''){ $list_obj->additional_query_part.= ($list_obj->additional_query_part=='')?'WHERE ':' AND '; $list_obj->additional_query_part.='`diametr` = \''.mysql_real_escape_string($dr).'\''; } } */ $content.='
'; $list_obj->get_list(); $list_obj->fields_list[]='bg_style'; $list_obj->fields_list[]='link'; foreach($list_obj->list_arr as $n=>$v){ $list_obj->list_arr[$n]['bg_style']=$bg_styles[($n/2)==round($n/2)]; if(is_file($cat_arr[2].'/'.$v['id'].'_1.jpg')){ $list_obj->list_arr[$n]['link']=$cat_arr[2].'/'.$v['id'].'_1.jpg'; }else{ $list_obj->list_arr[$n]['link']='#'; } } $pat=file_get_contents('html/'.$patterns[2]); //$content.=file_get_contents('html/cat.htm'); //$cat=$list_obj->show_all_list($pat); //$content=str_replace('%catalog%',$cat,$content); } // КАМЕРЫ if($p==3){ $content.='Товар: '.$tp[3].'
Тип транспорта: '.$tt[$t].'
'; $list_obj->table_name=$db_tables[3]; $list_obj->fields_list=$db_fields[3]; $list_obj->additional_query_part=''; if($t!=0){ $list_obj->additional_query_part.='WHERE `tt` = '.$t; } $content.='
'; $list_obj->get_list(); $list_obj->fields_list[]='bg_style'; foreach($list_obj->list_arr as $n=>$v){ $list_obj->list_arr[$n]['bg_style']=$bg_styles[($n/2)==round($n/2)]; } $pat=file_get_contents('html/'.$patterns[3]); //$content.=file_get_contents('html/cat.htm'); //$cat=$list_obj->show_all_list($pat); //$content=str_replace('%catalog%',$cat,$content); } // ЛЕНТЫ if($p==4){ $content.='Товар: '.$tp[4].'
Тип транспорта: '.$tt[$t].'
'; $list_obj->table_name=$db_tables[4]; $list_obj->fields_list=$db_fields[4]; $list_obj->additional_query_part=''; if($t!=0){ $list_obj->additional_query_part.='WHERE `tt` = '.$t; } $content.='
'; $list_obj->get_list(); $list_obj->fields_list[]='bg_style'; foreach($list_obj->list_arr as $n=>$v){ $list_obj->list_arr[$n]['bg_style']=$bg_styles[($n/2)==round($n/2)]; } $pat=file_get_contents('html/'.$patterns[4]); //$content.=file_get_contents('html/cat.htm'); //$cat=$list_obj->show_all_list($pat); //$content=str_replace('%catalog%',$cat,$content); } $content=''; // select TRANSPORT TYPE if($_GET['show_t']==1){ $tt_line=''; $link_pat=''; foreach($_GET as $n=>$v){ if($n!='t'){ if($link_pat!=''){$link_pat.='&';} $link_pat.=$n.'='.$v; } } $link_pat='search.htm?'.$link_pat.'&t=%tt%'; $tt_pat=file_get_contents('html/sel_tt.htm'); $tt_pat1=file_get_contents('html/sel_tt1.htm'); $tt_pat=str_replace('%link%',$link_pat,$tt_pat); foreach($tt as $n=>$v){ if($n==$_GET['t']){ $one_tt=str_replace('%name%',$v,$tt_pat1); }else{ $one_tt=str_replace('%tt%',$n,$tt_pat); $one_tt=str_replace('%name%',$v,$one_tt); } $tt_line.=$one_tt; } $content.=$tt_line.'

'; } $on_page=50; $pages=''; if($list_obj->list_len>$on_page){ $total_pages=ceil($list_obj->list_len/$on_page); $this_page=round(abs($_GET['page'])); if($this_page==0){$this_page=1;} if($this_page>$total_pages){$this_page=$total_pages;} $from=($this_page-1)*$on_page; $to=$this_page*$on_page-1; if($to>$list_obj->list_len){$to=$list_obj->list_len;} $cat=$list_obj->show_part_list($pat,$from,$to+1); $pages=file_get_contents('html/pages1.htm'); $pat1=file_get_contents('html/pages2.htm'); $pat2=file_get_contents('html/pages3.htm'); $link_pat=''; foreach($_GET as $n=>$v){ if($n!='page'){ if($link_pat!=''){$link_pat.='&';} $link_pat.=$n.'='.$v; } } $link_pat='search.htm?'.$link_pat.'&page=%num%'; $pat2=str_replace('%link%',$link_pat,$pat2); $pp=''; for($i=1;$i<=$total_pages;$i++){ $_pat=$pat2; if($i==$this_page){ $_pat=$pat1; } $pp.=str_replace('%num%',$i,$_pat); } $prev=$this_page-1; if($prev<1){$prev=$total_pages;} $prev=str_replace('%num%',$prev,$link_pat); $next=$this_page+1; if($next>$total_pages){$next=1;} $next=str_replace('%num%',$next,$link_pat); $pages=str_replace('%prev%',$prev,$pages); $pages=str_replace('%next%',$next,$pages); $pages=str_replace('%nums%',$pp,$pages); $content.=$pages; $content.=file_get_contents('html/cat.htm'); $content.=$pages; }else{ $cat=$list_obj->show_all_list($pat); $content.=file_get_contents('html/cat.htm'); } $content=str_replace('%catalog%',$cat,$content); $header='Каталог'; include('output.php'); ?>