Zacząłem zabawę php i natrafiłem na problem.
Próbuję zrealizować następującą stronkę:
Strona robocza
Jeżeli w wyszukiwarce wpiszę np. wd, rezultat zastępuje całą stronę.
Co powinienem zrobić, aby wynik wyświetlał się w środkowej części?
Kod wyszukiwarki:
Kod
<?php
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<script language="javascript"><!--
function check_form() {
var error_message = "<?php echo JS_ERROR; ?>";
var error_found = false;
var error_field;
var keywords = document.advanced_search.keywords.value;
var dfrom = document.advanced_search.dfrom.value;
var dto = document.advanced_search.dto.value;
var pfrom = document.advanced_search.pfrom.value;
var pto = document.advanced_search.pto.value;
var pfrom_float;
var pto_float;
if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
error_field = document.advanced_search.keywords;
error_found = true;
}
if (error_found == true) {
alert(error_message);
error_field.focus();
return false;
} else {
RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
return true;
}
}
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re
izable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,l
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<!-- body_text //-->
<td width="100%" valign="top">
<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT), 'get', 'onSubmit="return check_form(this);"') . tep_hide_session_id();
//echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onSubmit="return //check_form(this);"') . tep_hide_session_id();
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('text' => tep_draw_input_field('keywords', '', 'style="width: 100%"'));
new infoBox($info_box_contents);
?>
</td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="smallText" align="right"><?php echo tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH); ?></td>
</tr>
</table></td>
</tr>
</table></form></td>
</tr>
</table>
</body>
</html>
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<script language="javascript"><!--
function check_form() {
var error_message = "<?php echo JS_ERROR; ?>";
var error_found = false;
var error_field;
var keywords = document.advanced_search.keywords.value;
var dfrom = document.advanced_search.dfrom.value;
var dto = document.advanced_search.dto.value;
var pfrom = document.advanced_search.pfrom.value;
var pto = document.advanced_search.pto.value;
var pfrom_float;
var pto_float;
if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
error_field = document.advanced_search.keywords;
error_found = true;
}
if (error_found == true) {
alert(error_message);
error_field.focus();
return false;
} else {
RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
return true;
}
}
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re
izable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,l
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<!-- body_text //-->
<td width="100%" valign="top">
<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT), 'get', 'onSubmit="return check_form(this);"') . tep_hide_session_id();
//echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onSubmit="return //check_form(this);"') . tep_hide_session_id();
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('text' => tep_draw_input_field('keywords', '', 'style="width: 100%"'));
new infoBox($info_box_contents);
?>
</td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="smallText" align="right"><?php echo tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH); ?></td>
</tr>
</table></td>
</tr>
</table></form></td>
</tr>
</table>
</body>
</html>
Dziękuję za podpowiedź/odpowiedź.