Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: not2easy

&nsbp at top of site driving me nuts

Can't find it in the code to delete it...

   
8:24 pm on Sep 13, 2010 (gmt 0)

10+ Year Member



Hello All.

I've got a stowaway space "&nsbp" that is inserted onto most of my pages that bumps the design down, the result being extra white space at the top.

The space is being inserted into the head section of the site on every page that includes a call to a certain file, but I've looked at that file and can't find the pesky space.

Any hints or suggestions?
8:42 pm on Sep 13, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Add some text (like "111" and "222") at periodic places in the files. Reload the page and see if the text is being displayed before or after the "&nsbp" to narrow down the exact location where it's happening. (Note- look at the source code of the rendered page.)
3:15 pm on Sep 14, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



How are these pages being created, in an actual editor or a CMS? Is it an actual   or a literal &nbsp with the semicolon stripped?

I am visualizing this as a Dreamweaver shenanigan. :-) If you're using DW, open the code window and check it out, the doctype should be the first line, no spaces preceding it.

Another scenario is a CMS or Javascript editor like tiny_mce (or something) that is taking the literal space and converting it.

Third possibility, the PHP "byte order mark" artifact and it's being converted.
4:54 pm on Sep 14, 2010 (gmt 0)

10+ Year Member



LIA,
THat's a good tip-I didn't think of that.

rocknbil-It's an oscommerce installation, with dozens of mods installed (I'm embarrassed to say this) using an old version of Adobe Golive.

All the main pages call a file that creates custom meta tags for each page, and I've narrowed the issue to the meta tag controller because the space only appears on the pages that call this file. When I remove

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');

The space disappears (along with my meta tags).

the generated code is:

<!-- BOF: Generated Meta Tags -->
<assorted meta tags"></head><body rightmargin="0" leftmargin="0" bottommargin="0" topmargin="0" alink="#666666" bgcolor="white" link="#666666" marginheight="0" marginwidth="0" text="#666666" vlink="#666666">&nbsp;
<!-- EOF: Generated Meta Tags -->

You can see the offending &nbsp; at the end of the code.

Still digging...
6:06 pm on Sep 14, 2010 (gmt 0)

10+ Year Member



OK, in the header_tags.php I see this:

// ALL OTHER PAGES NOT DEFINED ABOVE
default:
$the_desc= HEAD_DESC_TAG_ALL;
$the_key_words= HEAD_KEY_TAG_ALL;
$the_title= HEAD_TITLE_TAG_ALL;
break;

}

Is the "break;" being turned into the extra space? And if so- can I remove it without consequence?
6:19 pm on Sep 14, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



From my understanding, "break" stops processing in for, while, do loops, and case structures. So you need to keep that.

Maybe get rid of the extra line between the break and the closing curly bracket?
7:50 pm on Sep 14, 2010 (gmt 0)

10+ Year Member



Removing the space didn't fix it-neither did removing the break;

It's the little things in life... that cause the most annoyance. ;-)
8:40 pm on Sep 14, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



What about the actual values of HEAD_DESC_TAG_ALL, HEAD_KEY_TAG_ALL, and HEAD_TITLE_TAG_ALL?
9:04 pm on Sep 14, 2010 (gmt 0)

10+ Year Member



Those are pulled from the db using the product descriptions or whatever text is added manually. I think it's outside of the actual values as it appears outside of the actual tags-but I could be wrong. will look into it.

I appreciate the suggestions!
9:09 pm on Sep 14, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



You have an unbalanced quote here:

<assorted meta tags"></hea

Typo?

Edit: sorry, posted from the hip after misreading.

In any case, the error shows up AFTER your body tag. I would double check whatever is generating that tag as well.
3:35 pm on Sep 16, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



the generated code is:

<!-- BOF: Generated Meta Tags -->
<assorted meta tags"></head><body rightmargin="0" leftmargin="0" bottommargin="0" topmargin="0" alink="#666666" bgcolor="white" link="#666666" marginheight="0" marginwidth="0" text="#666666" vlink="#666666">&nbsp;
<!-- EOF: Generated Meta Tags -->


<faints> And that's from OS commerce?

OK I would look at how this is configured, not familiar with OScommerce but surely there is either a set of settings or a template in which this is edited.

I'm *guessing* you have a form field with a template. If you're using a javascript editor like tinyMCE, hit the HTML tab and look for a space at the end. Note that in a form field, this

&nbsp;

will equal a plain space in a browser, just as this

&amp;

will render as

&

So when you update it, &nbsp; is getting stored in the database.
3:42 pm on Sep 21, 2010 (gmt 0)



maybe look at index.php, or in language folder, for the &nbsp; i have researched about this, and it looks maybe that the tag generator you are using is old and it's Header Tags Controller, and it was replaced with this Header Tags SEO V 3.0 : [addons.oscommerce.com...]
And as far as i see, this new one is compatible with latest os commerce solution. Have a try.
7:23 pm on Sep 23, 2010 (gmt 0)

10+ Year Member



Yeah, I'm in the process of updating the add on, but my flies are all so modified that a simple install is impossible. Now instead of chasing the extra &nbsp; (an issue which the latest version corrects) I'm looking for an unexpected '}' in a file with 2000 lines of code.

Of course, it isn't on line 1374 like the error suggests, as that block of code is identical to the functioning version. So, I'm going to go through the whole file again, testing each change as I add it to see where I messed up-unless someone has a faster way to find a missing bracket?
10:11 pm on Sep 23, 2010 (gmt 0)

10+ Year Member



VICTORY!

I have F I N A L L Y got the updated version of the mod installed and operating on the dev site. Though the solution I ended up using was comparable to swatting a fly with a wrecking ball, it worked.

I may never find out what caused it, but the stowaway space is finally dead.

Thanks to all of you for your suggestions!
1:37 am on Nov 17, 2010 (gmt 0)

10+ Year Member



I know absolute positioning is frowned upon, but it does sometimes help to set the top-left hand corner to (0, 0) and nail it in place.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month