Обращаюсь за помощью к профиссионалам.
В модуле "ПОИСК" http://www.gizzo.ru/index.php?name=search
не могу настроить множественный поиск из выпадающего списка.
Модуль поиска выдает результаты либо по первому окну,
либо только по второму, НЕ получается их связать в один цикл.
В модуле "ПОИСК" http://www.gizzo.ru/index.php?name=search
не могу настроить множественный поиск из выпадающего списка.
Модуль поиска выдает результаты либо по первому окну,
либо только по второму, НЕ получается их связать в один цикл.
<?php
if (!defined("MODULE_FILE")) {
Header("Location: ../../index.php");
exit;
}
get_lang($conf['name']);
function search_result() {
global $prefix, $db, $product_cid, $pagetitle, $admin_file, $conf, $confu;
$word = ($_POST['word']) ? text_filter($_POST['word']) : text_filter($_GET['word']);
$cat = (isset($_POST['cat'])) ? ((isset($_POST['cat'])) ? analyze($_POST['cat']) : "") : ((isset($_GET['cat'])) ? analyze($_GET['cat']) : "");
$cat = ($cat) ? $cat : 0;
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$display = ($conf['display']) ? "" : "style=\"display:none;\"";
$navi = "<img src=\"".img_find("misc/navi")."\" border=\"0\">";
$search = explode(",", $conf['search']);
$pagetitle = ($word) ? "".$conf['defis']." "._SEARCH." ".$conf['defis']." $word" : "".$conf['defis']." "._SEARCH."";
$lang = array(_SHOP);
$m = 0;
$sel = "";
foreach ($search as $val) {
if (is_active($val) && $val != "") {
$sel = ($val == $cat && $cat != "") ? "selected" : "";
$catcont .= "<option value=\"$val\" $sel>".$lang[$m]."</option>";
}
$m++;
}
$stop = ($word && strlen($word) < $conf['searchlet']) ? ""._SEARCHLETMIN.": ".$conf['searchlet']."" : "";
head();
title(""._SEARCH."");
open();
echo "<table align=\"center\"><form action=\"index.php?name=".$conf['name']."\" method=\"post\"><tr>"
."<td align=\"center\"><select type=\"text\" name=\"word\">
<option value=\" \">Выберите наиболее подходящий размер</option>
<option value=\"56-рост\">56 рост</option>
<option value=\"62-рост\">62 рост</option>
<option value=\"68-рост\">68 рост</option>
<option value=\"74-рост\">74 рост</option>
<option value=\"74-80-рост\">74-80 рост</option>
<option value=\"80-рост\">80 рост</option>
<option value=\"80-86-рост\">80-86 рост</option>
<option value=\"86-рост\">86 рост</option>
<option value=\"86-92-рост\">86-92 рост</option>
<option value=\"92-рост\">92 рост</option>
<option value=\"92-98-рост\">92-98 рост</option>
<option value=\"98-рост\">98 рост</option>
<option value=\"98-104-рост\">98-104 рост</option>
<option value=\"104-рост\">104 рост</option>
<option value=\"104-110-рост\">104-110 рост</option>
<option value=\"110-рост\">110 рост</option>
<option value=\"110-116-рост\">110-116 рост</option>
<option value=\"116-рост\">116 рост</option>
<option value=\"116-122-рост\">116-122 рост</option>
<option value=\"122-рост\">122 рост</option>
<option value=\"122-128-рост\">122-128 рост</option>
<option value=\"128-рост\">128 рост</option>
<option value=\"128-134-рост\">128-134 рост</option>
<option value=\"134-рост\">134 рост</option>
<option value=\"134-140-рост\">134-140 рост</option>
<option value=\"140-рост\">140 рост</option></td>"
."<td align=\"center\"><select type=\"text\" name=\"word\">
<option value=\" \">Пол</option>
<option value=\"07-\">Для девочек</option>
<option value=\"08-\">Для мальчиков</option>
</td>"
."<td align=\"center\"><input type=\"submit\" title=\""._SEARCH."\" value=\""._SEARCH."\" class=\"fbutton\"></td>"
."</tr></form></table>";
close();
if (!$stop && $word) {
foreach ($search as $val) {
if ((!$cat || $cat == $val) && is_active($val) && $val != "") {
if ($val == "auto_links") {
$result = $db->sql_query("SELECT id, sitename, description, link, added FROM ".$prefix."_auto_links WHERE hits!='0' AND (sitename LIKE '%".$word."%' OR description LIKE '%".$word."%' OR link LIKE '%".$word."%') ORDER BY added DESC");
while (list($id, $title, $description, $link, $date) = $db->sql_fetchrow($result)) {
$link = preg_replace("/http\:\/\/|www\./", "", $link);
$atitle = "<a href=\"index.php?name=$val&op=view&id=$id\" title=\"$title\">".search_color($title, $word)."</a>";
$aimg = "<span id=\"cont\"><img src=\"".img_find("all/plus")."\" border=\"0\" align=\"center\" alt=\""._READMORE."\" title=\""._READMORE."\" id=\"menu".$a."\" OnClick=\"SwitchMenu('sub".$a."')\" style=\"cursor:pointer;\"></span>";
$ahref = "<a href=\"index.php?name=$val&op=view&id=$id\" target=\"_blank\" title=\""._WINDOWNEW."\"><img src=\"".img_find("all/content")."\" border=\"0\" align=\"center\" alt=\""._WINDOWNEW."\"></a>";
$text = "<div id=\"sub".$a."\" $display>".search_color(bb_decode($description, $val), $word)."</div>";
$tdate = ""._DATE.": ".format_time($date)."";
$tcategory = ""._CATEGORY.": <a href=\"index.php?name=$val\" title=\"".$lang[0]."\">".$lang[0]."</a>";
$link = ($link) ? ""._SITEURL.": <a href=\"index.php?name=$val&op=view&id=$id\" target=\"_blank\" title=\"".$title."\">".search_color(str_replace(array("http://", "www."), "", $link), $word)."</a>" : "";
$edit = (is_moder($val)) ? "".ad_edit("".$admin_file.".php?op=auto_links_add&id=".$id."")."" : "";
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, $tdate, $tcategory, "", "", $link);
$a++;
}
} elseif ($val == "shop") {
$result = $db->sql_query("SELECT p.product_id, p.product_time, p.product_title, p.product_text, p.product_desc, c.id, c.title FROM ".$prefix."_products AS p LEFT JOIN ".$prefix."_categories AS c ON (p.product_cid=c.id) WHERE product_time <= now() AND product_active='1' AND (p.product_title LIKE '%".$word."%' OR p.product_text LIKE '%".$word."%' OR p.product_desc LIKE '%".$word."%') ORDER BY product_time DESC");
while (list($id, $date, $title, $hometext, $bodytext, $cid, $ctitle) = $db->sql_fetchrow($result)) {
$atitle = "<a href=\"index.php?name=$val&op=view&id=$id&word=".urlencode($word)."\" title=\"$title\">".search_color($title, $word)."</a>";
$description = ($bodytext) ? "".$hometext."<br /><br />".$bodytext."" : $hometext;
$text = "<div id=\"sub".$a."\" $display>".search_color(bb_decode($description, $val), $word)."</div>";
$edit = (is_moder($val)) ? "".ad_edit("".$admin_file.".php?op=shop_add_products&id=".$id."")."" : "";
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, "", "");
$a++;
}
}
}
}
$offset = ($num - 1) * $conf['searchnum'];
echo '<script language="javascript" type="text/javascript">
var link;
for (var i = 0; link = document.links[i]; i++) {
if (link.className=="highslide") {
link.onclick=function() {
var hid=this.href.replace(/^(.+)images\/shop\/(\d+)-(\d+)-(\d+)_(\w+)\/(.+)/g,"id-$2-$3-$4-$5");
return hs.expand(this, { slideshowGroup: hid });
};
}
}
</script>';
$tnum = ($offset) ? $conf['searchnum'] + $offset : $conf['searchnum'];
for ($i = $offset; $i < $tnum; $i++) {
if ($conts[$i] != "") basic($conts[$i][0], $conts[$i][1], $conts[$i][2], $conts[$i][3], $conts[$i][4], $conts[$i][5], $conts[$i][6], $conts[$i][7], $conts[$i][8], $conts[$i][9], $conts[$i][10]);
}
if (!$a) warning(""._NOMATCHES."", "", "", 1);
$numpages = ceil($a / $conf['searchnum']);
num_page($conf['name'], $a, $numpages, $conf['searchnum'], "mod=$mod&word=".urlencode($word)."&");
} else {
if ($stop) {
$winfo = $stop;
$typ = "1";
} else {
$winfo = ""._SEARCHINFO."";
$typ = "2";
}
warning($winfo, "", "", $typ);
}
if ($a >= 10) get_page($conf['name']);
foot();
}
switch($op) {
default:
search_result();
break;
}
?>
if (!defined("MODULE_FILE")) {
Header("Location: ../../index.php");
exit;
}
get_lang($conf['name']);
function search_result() {
global $prefix, $db, $product_cid, $pagetitle, $admin_file, $conf, $confu;
$word = ($_POST['word']) ? text_filter($_POST['word']) : text_filter($_GET['word']);
$cat = (isset($_POST['cat'])) ? ((isset($_POST['cat'])) ? analyze($_POST['cat']) : "") : ((isset($_GET['cat'])) ? analyze($_GET['cat']) : "");
$cat = ($cat) ? $cat : 0;
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$display = ($conf['display']) ? "" : "style=\"display:none;\"";
$navi = "<img src=\"".img_find("misc/navi")."\" border=\"0\">";
$search = explode(",", $conf['search']);
$pagetitle = ($word) ? "".$conf['defis']." "._SEARCH." ".$conf['defis']." $word" : "".$conf['defis']." "._SEARCH."";
$lang = array(_SHOP);
$m = 0;
$sel = "";
foreach ($search as $val) {
if (is_active($val) && $val != "") {
$sel = ($val == $cat && $cat != "") ? "selected" : "";
$catcont .= "<option value=\"$val\" $sel>".$lang[$m]."</option>";
}
$m++;
}
$stop = ($word && strlen($word) < $conf['searchlet']) ? ""._SEARCHLETMIN.": ".$conf['searchlet']."" : "";
head();
title(""._SEARCH."");
open();
echo "<table align=\"center\"><form action=\"index.php?name=".$conf['name']."\" method=\"post\"><tr>"
."<td align=\"center\"><select type=\"text\" name=\"word\">
<option value=\" \">Выберите наиболее подходящий размер</option>
<option value=\"56-рост\">56 рост</option>
<option value=\"62-рост\">62 рост</option>
<option value=\"68-рост\">68 рост</option>
<option value=\"74-рост\">74 рост</option>
<option value=\"74-80-рост\">74-80 рост</option>
<option value=\"80-рост\">80 рост</option>
<option value=\"80-86-рост\">80-86 рост</option>
<option value=\"86-рост\">86 рост</option>
<option value=\"86-92-рост\">86-92 рост</option>
<option value=\"92-рост\">92 рост</option>
<option value=\"92-98-рост\">92-98 рост</option>
<option value=\"98-рост\">98 рост</option>
<option value=\"98-104-рост\">98-104 рост</option>
<option value=\"104-рост\">104 рост</option>
<option value=\"104-110-рост\">104-110 рост</option>
<option value=\"110-рост\">110 рост</option>
<option value=\"110-116-рост\">110-116 рост</option>
<option value=\"116-рост\">116 рост</option>
<option value=\"116-122-рост\">116-122 рост</option>
<option value=\"122-рост\">122 рост</option>
<option value=\"122-128-рост\">122-128 рост</option>
<option value=\"128-рост\">128 рост</option>
<option value=\"128-134-рост\">128-134 рост</option>
<option value=\"134-рост\">134 рост</option>
<option value=\"134-140-рост\">134-140 рост</option>
<option value=\"140-рост\">140 рост</option></td>"
."<td align=\"center\"><select type=\"text\" name=\"word\">
<option value=\" \">Пол</option>
<option value=\"07-\">Для девочек</option>
<option value=\"08-\">Для мальчиков</option>
</td>"
."<td align=\"center\"><input type=\"submit\" title=\""._SEARCH."\" value=\""._SEARCH."\" class=\"fbutton\"></td>"
."</tr></form></table>";
close();
if (!$stop && $word) {
foreach ($search as $val) {
if ((!$cat || $cat == $val) && is_active($val) && $val != "") {
if ($val == "auto_links") {
$result = $db->sql_query("SELECT id, sitename, description, link, added FROM ".$prefix."_auto_links WHERE hits!='0' AND (sitename LIKE '%".$word."%' OR description LIKE '%".$word."%' OR link LIKE '%".$word."%') ORDER BY added DESC");
while (list($id, $title, $description, $link, $date) = $db->sql_fetchrow($result)) {
$link = preg_replace("/http\:\/\/|www\./", "", $link);
$atitle = "<a href=\"index.php?name=$val&op=view&id=$id\" title=\"$title\">".search_color($title, $word)."</a>";
$aimg = "<span id=\"cont\"><img src=\"".img_find("all/plus")."\" border=\"0\" align=\"center\" alt=\""._READMORE."\" title=\""._READMORE."\" id=\"menu".$a."\" OnClick=\"SwitchMenu('sub".$a."')\" style=\"cursor:pointer;\"></span>";
$ahref = "<a href=\"index.php?name=$val&op=view&id=$id\" target=\"_blank\" title=\""._WINDOWNEW."\"><img src=\"".img_find("all/content")."\" border=\"0\" align=\"center\" alt=\""._WINDOWNEW."\"></a>";
$text = "<div id=\"sub".$a."\" $display>".search_color(bb_decode($description, $val), $word)."</div>";
$tdate = ""._DATE.": ".format_time($date)."";
$tcategory = ""._CATEGORY.": <a href=\"index.php?name=$val\" title=\"".$lang[0]."\">".$lang[0]."</a>";
$link = ($link) ? ""._SITEURL.": <a href=\"index.php?name=$val&op=view&id=$id\" target=\"_blank\" title=\"".$title."\">".search_color(str_replace(array("http://", "www."), "", $link), $word)."</a>" : "";
$edit = (is_moder($val)) ? "".ad_edit("".$admin_file.".php?op=auto_links_add&id=".$id."")."" : "";
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, $tdate, $tcategory, "", "", $link);
$a++;
}
} elseif ($val == "shop") {
$result = $db->sql_query("SELECT p.product_id, p.product_time, p.product_title, p.product_text, p.product_desc, c.id, c.title FROM ".$prefix."_products AS p LEFT JOIN ".$prefix."_categories AS c ON (p.product_cid=c.id) WHERE product_time <= now() AND product_active='1' AND (p.product_title LIKE '%".$word."%' OR p.product_text LIKE '%".$word."%' OR p.product_desc LIKE '%".$word."%') ORDER BY product_time DESC");
while (list($id, $date, $title, $hometext, $bodytext, $cid, $ctitle) = $db->sql_fetchrow($result)) {
$atitle = "<a href=\"index.php?name=$val&op=view&id=$id&word=".urlencode($word)."\" title=\"$title\">".search_color($title, $word)."</a>";
$description = ($bodytext) ? "".$hometext."<br /><br />".$bodytext."" : $hometext;
$text = "<div id=\"sub".$a."\" $display>".search_color(bb_decode($description, $val), $word)."</div>";
$edit = (is_moder($val)) ? "".ad_edit("".$admin_file.".php?op=shop_add_products&id=".$id."")."" : "";
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, "", "");
$a++;
}
}
}
}
$offset = ($num - 1) * $conf['searchnum'];
echo '<script language="javascript" type="text/javascript">
var link;
for (var i = 0; link = document.links[i]; i++) {
if (link.className=="highslide") {
link.onclick=function() {
var hid=this.href.replace(/^(.+)images\/shop\/(\d+)-(\d+)-(\d+)_(\w+)\/(.+)/g,"id-$2-$3-$4-$5");
return hs.expand(this, { slideshowGroup: hid });
};
}
}
</script>';
$tnum = ($offset) ? $conf['searchnum'] + $offset : $conf['searchnum'];
for ($i = $offset; $i < $tnum; $i++) {
if ($conts[$i] != "") basic($conts[$i][0], $conts[$i][1], $conts[$i][2], $conts[$i][3], $conts[$i][4], $conts[$i][5], $conts[$i][6], $conts[$i][7], $conts[$i][8], $conts[$i][9], $conts[$i][10]);
}
if (!$a) warning(""._NOMATCHES."", "", "", 1);
$numpages = ceil($a / $conf['searchnum']);
num_page($conf['name'], $a, $numpages, $conf['searchnum'], "mod=$mod&word=".urlencode($word)."&");
} else {
if ($stop) {
$winfo = $stop;
$typ = "1";
} else {
$winfo = ""._SEARCHINFO."";
$typ = "2";
}
warning($winfo, "", "", $typ);
}
if ($a >= 10) get_page($conf['name']);
foot();
}
switch($op) {
default:
search_result();
break;
}
?>
Версия системы: SLAED CMS 4.2 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете