(.*)|sU', $str, $res); $arr_url = array_combine($res[1], $res[2]); if (isset($_GET['cat'])) { $p = isset($_GET['p']) ? intval($_GET['p']) : 1; $url .= 'category/' . $_GET['cat'] . '/page' . $p . '.html'; $str = file_get_contents($url); $str = mb_convert_encoding($str, 'HTML-ENTITIES', 'cp-1251'); preg_match_all('|(.*)|sU', $str, $img_url); preg_match_all('|(.*)|sU', $str, $name); $name = str_replace(array('

', '

'), '' , $name[1]); $arr_name = array_combine($img_url[1], $name); $arr_img = array_combine($img_url[1], $img_url[2]); preg_match_all('|(.*)|sU', $str, $nav); $nav = str_replace(array('/page', 'category/', '.html', '
', '<<', '>>>'), array('&p=', $pg . '?cat=', '', '', '<<', '>>>'), $nav[1][0]); echo ''; $i=0; foreach ($arr_img as $k => $v) { if (($i%3)==0 && $i!=0) { echo ''; } echo '' . PHP_EOL; $i++; } echo '
' . $arr_url[$_GET['cat']] . '
img
' . $arr_name[$k] . '
'; echo '
' . $nav . '
'; echo '
' . mb_convert_encoding('К выбору категорий', 'HTML-ENTITIES', 'UTF-8') . '
'; } if (empty($_GET)) { foreach ($arr_url as $k => $v) { echo '
' . $v . '
' . PHP_EOL; } } require_once($rootpath . 'incfiles/end.php'); ?>