Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mystery "1" when moving Search box to header.php?


Guest

Recommended Posts

Posted

Hi,

 

Just trying to make a few mods to customise the look and feel of a site and have come across a small problem.

 

I get a mystery number '1' at the top of the header now since moving the Search box to header.php from column_left.php.

 

Any clues? It's probably something I've done, but I can't for the life of me work out what it is. I did mod's one at a time, and it seemed to happen when I took away the box header code from header.php. I have since put it back in and it still didn't work, so I took it back out again.

 

All is fine in IE, just Mozilla displays this mystery '1' and it's throughout the entire site.

 

I would appreciate any assistance you can provide.

 

Cheers,

Leah :)

Posted

Has anyone moved the search box into the header? If you have, do you have any hints on what might have happened?

 

Thanks in advance,

Leah :)

Posted

Would you please post the code here for your store/includes/header.php? You do have a 1. Let's get it out of there :)

 

jon

It's all just ones and zeros....

Posted

Hi Jon,

 

Thanks for your reply. Here's the code from the header.php file. Hoping you can help!

 

Cheers,

Leah :)

 

<?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 © 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');

}

}

}

 

// 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');

}

?>

<div class="fixcenter">

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr class="header">

<td style="padding-left: 20px;" valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'chic_logo.jpg', 'Chic Lingerie') . '</a>'; ?></td>

<td><?php echo require(DIR_WS_BOXES . 'search.php'); ?></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"><?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

}

?>

Posted

Well, it's not in there... Let's have your store/index.php down to <!-- body_text //-->

 

Sorry to make you work like this :)

 

jon

It's all just ones and zeros....

Posted

Not a problem at all. I'm thankful that you are helping.

 

Here 'tis:

 

<?php

/*

$Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);

if ($cateqories_products['total'] > 0) {

$category_depth = 'products'; // display products

} else {

$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

$category_parent = tep_db_fetch_array($category_parent_query);

if ($category_parent['total'] > 0) {

$category_depth = 'nested'; // navigate through the categories

} else {

$category_depth = 'products'; // category has no products, but display the 'no products' message

}

}

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

<!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; ?>">

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

Posted

I was also going to add that I did change the formatting of the table in 'search.php' and thought it might have been in there, but can't find anything. I have checked it against my original file, but have found nothing out of the ordinary.

 

Here's the code from the search.php if it helps?

 

<?php

/*

$Id: search.php,v 1.22 2003/02/10 22:31:05 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- search //-->

<td valign="bottom">

<?php

$info_box_contents = array();

// $info_box_contents[] = array('text' => BOX_HEADING_SEARCH);

 

// new SearchBoxHeading($info_box_contents, false, false);

 

$info_box_contents = array();

$info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),

'align' => 'right',

'text' => tep_draw_input_field('keywords', '', 'size="10" value="Enter search term" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . ' ' . BOX_SEARCH_TEXT);

 

new SearchBox($info_box_contents);

?>

</td>

<!-- search_eof //-->

 

Also, I know it's a big ask, but you wouldn't know how to add an onfocus function into the search box would you? I tried adding the HTML after the value, as below:

 

'text' => tep_draw_input_field('keywords', '', 'size="10" value="Enter search term" onFocus="if(this.value=='Enter search term')this.value='';" onblur="if(this.value=='')this.value='Enter search term';" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . ' ' . BOX_SEARCH_TEXT);

 

It was around this time that the 1 appeared too, so it might be something to do with that?

 

Thanks again for all your help so far!

Posted

The 1 has shown up for me when editing the way the boxes look when editing /classes/boxes.php, so it may not have anything to do with your header at all. But then again it could. : ) I am not sure, looking at your code quickly.

 

I would suggest going back to an unedited version of the header (you did make a backup copy right?) and looking at these contributions. Different ways to put the search in your header... and different types of searches.

 

http://www.oscommerce.com/community/contributions,4514

http://www.oscommerce.com/community/contributions,3295

http://www.oscommerce.com/community/contributions,2536

http://www.oscommerce.com/community/contributions,3230

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

Thanks Wendy,

 

I will try doing just that. And yes, I do have a backup (thankfully). :thumbsup:

 

I didn't think about looking in the contributions section, just thought it would be as simple as moving the elements. Oh well, I am learning fast!

 

Cheers,

Leah :)

Posted

Because of the way the boxes are made it can cause a problem but usually only with the layout.

 

If you look at the search.php you can see there is no <table> start or end tag... so you need to at least add those in, or on the page you are adding the box add them before and after calling for the box. Then just call for it like <?php include (DIR_WS_BOXES . 'search.php'); ?>. I hope that makes sense.

 

The contributions also change the look of the search box though so looking at them and the code is a good way to learn. Trial and error is how I did it. : )

 

I am still not sure about why the 1 is showing up for you though. Mine showed up when I tried removing a piece of code in the boxes.php file to alter how the boxes looked.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

Same thing happened to me once and as Wendy said, when changing the infoBoxHeading Class. I think it happens when removing the corner_left.gif, although I don't remember exactly.

I would comment out the calls for the boxes one at a time to see what one is giving the problem. I think it is the search box. You may need to create your own corner_left.gif so it all continues nicely.

 

<?php // echo require(DIR_WS_BOXES . 'search.php'); ?>

Posted

Thanks for your help.

 

I will have a look into that boxes thing and also add in the table start and end tag. Do I just add them in html or do I have to do php? Must be something relatively small causing the 1 though.

 

Leah :)

Posted

What is this?

 

('keywords', '', 'size="10" value="Enter search term" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"')

 

jon

It's all just ones and zeros....

Posted
What is this?

 

('keywords', '', 'size="10" value="Enter search term" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"')

 

jon

 

It is the box width, minus 30px. Standard width 125px - 30px = 95px

  • 3 weeks later...
Posted

Hi all,

 

I ended up checking out the "Search Box Anywhere" contribution and getting rid of the search info box altogether. I just put the code straight into the header.php file, and the 1 magically disappeared. I think it was to do with the <table> code, so this eliminated all the dramas when I put the code straight into the header.php file.

 

I just wanted to thank you all for your advice and assistance! I hope this post helps someone else!

 

Cheers,

Leah :)

  • 2 years later...
Posted

2 years later and it has helped me! thankyou guys for posting this..even tho i didnt get the 1 problem i was just trying to move the code around and it has been giving me a super huge headache! anyways.., im going to use that same contribution.

 

Cheers Matez

Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...