请教如何在php的页面中控制一个目标出现的位置
比方说在一个php页面中本来顶部的banner的显示在中间的,现在我想让它贴着左边和浏览器顶部显示,请教该怎么做,我试着用了html中的body 语句,但是没有用,请各位高手多多指点。 我觉得应该算css范畴吧。楼主可以贴出代码,把问题说详细些。 你应该修改 php文档 调用的 html 模板文件,如果是直接写在php文档中,则查找和修改 echo 后的相应代码。 .css里面的margin本来就设置为0另外这个网站采用的不是调用html模版的方式,而是直接写在php里。
<script language="JavaScript" type="text/JavaScript">
<!--
function openNewWindow(pURL, pW, pH, pScrollbar) {
theURL = pURL;
winName = "Aktion";
w = pW;
h = pH;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2.5 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+pScrollbar;
newwin = window.open(theURL,winName,settings);
setTimeout('newwin.focus();',900);
newwin.left = 0;
void(0);
}
//-->
</script>
<?php
/*
$Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
// check if the 'install' directory exists, and warn of its existence
if (WARN_INSTALL_EXISTENCE == 'true') {
if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
$messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
}
}
// check if the configure.php file is writeable
if (WARN_CONFIG_WRITEABLE == 'true') {
if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
$messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
}
}
// check if the session folder is writeable
if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
if (STORE_SESSIONS == '') {
if (!is_dir(tep_session_save_path())) {
$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
} elseif (!is_writeable(tep_session_save_path())) {
$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
}
}
}
// give the visitors a message that the website will be down at ... time
if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) {
$messageStack->add('header', TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE, 'warning');
}
// this will let the admin know that the website is DOWN FOR MAINTENANCE to the public
if ( (DOWN_FOR_MAINTENANCE == 'true') && (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE == getenv('REMOTE_ADDR')) ) {
$messageStack->add('header', TEXT_ADMIN_DOWN_FOR_MAINTENANCE, 'warning');
}
// check session.auto_start is disabled
if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
if (ini_get('session.auto_start') == '1') {
$messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
}
}
if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
$messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
}
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
?>
<br>
<table width="900" cellspacing="0" cellpadding="0" align="center" class="headerTable_custom">
<tr>
<td valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr class="header" height="120">
<td valign="bottom" height="120" class="tableBg_custom"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'shoplogo.gif', 'Huntingten GmbH') . '</a>'; ?></td>
<td align="right" valign="bottom" height="120" class="tableBg_custom"><?php if ($_SERVER['HTTP_X_FORWARDED_HOST'] == 'ssl.kundenserver.de') {echo tep_image(DIR_WS_IMAGES . 'shoplogo2.jpg', 'Huntingten GmbH');} else { echo '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="217" HEIGHT="140" id="logo_rh" ALIGN="">
<PARAM NAME=movie VALUE="logo_rh.swf"> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=opaque> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="logo_rh.swf" menu=false quality=high wmode=opaque bgcolor=#FFFFFFWIDTH="217" HEIGHT="140" NAME="logo_rh" ALIGN=""
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>';} ?><!-- <?php echo tep_image(DIR_WS_IMAGES . 'shoplogo2.jpg', 'Huntingten GmbH'); ?> --><!-- <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>--></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1">
<tr class="headerNavigation">
<td class="headerNavigation"><?php echo $breadcrumb->trail(' » '); ?></td>
<td align="right" class="headerNavigation"><a href="javascript:openNewWindow('popup_win.htm', '400', '450', 'yes');" class="headerNavigation"/a>|<?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>|<?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>|<a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>|<a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a></td>
</tr>
</table>
<?php
if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
</tr>
</table>
<?php
}
if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="headerInfo">
<td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
</tr>
</table>
<?php
}
?>
以上是这一页的所有代码
下面是css文件里的代码
/*
$Id: stylesheet.css,v 1.56 2003/06/30 20:04:02 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
.boxText { font-family: Verdana, Arial, sans-serif; font-size: 11px; }
.errorBox { font-family : Verdana, Arial, sans-serif; font-size : 11px; background: #ffb3b5; font-weight: bold; }
.stockWarning { font-family : Verdana, Arial, sans-serif; font-size : 11px; color: #cc0033; }
.productsNotifications { background: #f2fff7; }
.orderEdit { font-family : Verdana, Arial, sans-serif; font-size : 11px; color: #aab3c3; text-decoration: underline; }
BODY {
background: #bbc3d3;
color: #000000;
margin: 0px;
}
A {
color: #000000;
text-decoration: none;
}
A:hover {
color: #AABBDD;
text-decoration: underline;
}
FORM {
display: inline;
}
TR.header {
background: #ffffff;
}
TR.headerNavigation {
background: #bbc3d3;
}
TD.headerNavigation {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
background: #bbc3d3;
color: #ffffff;
font-weight : bold;
}
A.headerNavigation {
color: #FFFFFF;
}
A.headerNavigation:hover {
color: #ffffff;
}
TR.headerError {
background: #ff0000;
}
TD.headerError {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
background: #ff0000;
color: #ffffff;
font-weight : bold;
text-align : center;
}
TR.headerInfo {
background: #00ff00;
}
TD.headerInfo {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
background: #00ff00;
color: #ffffff;
font-weight: bold;
text-align: center;
}
TR.footer {
background: #bbc3d3;
}
TD.footer {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
background: #bbc3d3;
color: #ffffff;
font-weight: bold;
}
.infoBox {
background: #b6b7cb;
}
.infoBoxContents {
background: #f8f8f9;
background-image: url(images/infobox/box_bg.gif);
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
.customInfoBoxContents {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
.infoBoxNotice {
background: #FF8E90;
}
.infoBoxNoticeContents {
background: #FFE6E6;
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
TD.infoBoxHeading {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
font-weight: bold;
background: #bbc3d3;
color: #ffffff;
}
TD.infoBox, SPAN.infoBox {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
TR.accountHistory-odd, TR.addressBook-odd, TR.alsoPurchased-odd, TR.payment-odd, TR.productListing-odd, TR.productReviews-odd, TR.upcomingProducts-odd, TR.shippingOptions-odd {
background: #f8f8f9;
}
TR.accountHistory-even, TR.addressBook-even, TR.alsoPurchased-even, TR.payment-even, TR.productListing-even, TR.productReviews-even, TR.upcomingProducts-even, TR.shippingOptions-even {
background: #f8f8f9;
}
TABLE.productListing {
border: 1px;
border-style: solid;
border-color: #b6b7cb;
border-spacing: 1px;
}
.productListing-heading {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
background: #b6b7cb;
color: #FFFFFF;
font-weight: bold;
}
TD.productListing-data {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
background: #ffffff;
}
A.pageResults {
color: #0000FF;
}
A.pageResults:hover {
color: #0000FF;
background: #FFFFFF;
}
TD.pageHeading, DIV.pageHeading {
font-family: Verdana, Arial, sans-serif;
font-size: 20px;
font-weight: bold;
color: #9a9a9a;
}
TR.subBar {
background: #f4f7fd;
}
TD.subBar {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
color: #000000;
}
TD.main, P.main {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
line-height: 1.5;
}
TD.smallText, SPAN.smallText, P.smallText {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
TD.accountCategory {
font-family: Verdana, Arial, sans-serif;
font-size: 13px;
color: #aabbdd;
}
TD.fieldKey {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
font-weight: bold;
}
TD.fieldValue {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
}
TD.tableHeading {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
font-weight: bold;
}
SPAN.newItemInCart {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
color: #ff0000;
}
CHECKBOX, INPUT, RADIO, SELECT {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
TEXTAREA {
width: 100%;
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
SPAN.greetUser {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
color: #f0a480;
font-weight: bold;
}
TABLE.formArea {
background: #f1f9fe;
border-color: #7b9ebd;
border-style: solid;
border-width: 1px;
}
TD.formAreaTitle {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
font-weight: bold;
}
SPAN.markProductOutOfStock {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
color: #c76170;
font-weight: bold;
}
SPAN.productSpecialPrice {
font-family: Verdana, Arial, sans-serif;
color: #ff0000;
}
SPAN.errorText {
font-family: Verdana, Arial, sans-serif;
color: #ff0000;
}
.moduleRow { }
.moduleRowOver { background-color: #D7E9F7; cursor: pointer; cursor: hand; }
.moduleRowSelected { background-color: #E9F4FC; }
.checkoutBarFrom, .checkoutBarTo { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #8c8c8c; }
.checkoutBarCurrent { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #000000; }
/* message box */
.messageBox { font-family: Verdana, Arial, sans-serif; font-size: 11px; }
.messageStackError, .messageStackWarning { font-family: Verdana, Arial, sans-serif; font-size: 11px; background-color: #ffb3b5; }
.messageStackSuccess { font-family: Verdana, Arial, sans-serif; font-size: 11px; background-color: #99ff00; }
/* input requirement */
.inputRequirement { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #ff0000; }
.headerTable_custom {
border-top: 3px solid #00185E;
border-right: 3px solid #00185E;
border-bottom: 3px solid #00185E;
border-left: 3px solid #00185E;
background-color: #FFFFFF;
}
.tableBg_custom {
background-color: #00185E;
}
.custom_picframe {
border-top: 2px solid #dddddd;
border-right: 2px solid #888888;
border-bottom: 2px solid #888888;
border-left: 2px solid #dddddd;
}
.customSmall {
font-family : Verdana, Arial, sans-serif;
font-size: 9px;
color: #666666;
}
SPAN.cvvHelp {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
是不是需要改的是echo后面的html代码?
不好意思,新手上路,还请大家多多指教
$汗$ $汗$
页:
[1]