Someone give me a hoover, i need to neaten my code up...

They have: 5,633 posts

Joined: Jan 1970

Hi All,

Got another quick question for you clever people.

Iv set up reseller site and for some reason when i view the source of the page from my browser, all the code is all over the shop instead of neatly sorter like it is in my html editor.

Im just wondering if thats a problem and how it can be sorted out if at all?

P.S. The funtionality of he site is fine, works for the most part like its supposed to, its just the code is messy when i view the source from the browser.

Smiling

Thanks peeps

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Whitespace does not matter how your HTML is displayed. I'm guessing that your editor treats tabs differently than your source viewer.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

pr0gr4mm3r is correct - whitespace does not matter

perhaps your server is using some kind of compression, stripping the whitespace, for more compact/efficient files?

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

when i view the source of the page from my browser, all the code is all over the shop instead of neatly sorter like it is in my html editor.

I'm guessing that your editor treats tabs differently than your source viewer.

Exactly. You should check the options of the code editor, see if there's an option to use spaces instead of tabs. Spaces are always formatted the same, no matter what software is showing them.

Also, if you switch to spaces instead of tabs, you won't be among the first against the wall when the anti-tab revolution comes.

a Padded Cell our articles site!

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

JeevesBond wrote:

Spaces are always formatted the same, no matter what software is showing them.

True, for text editors.

However, rich text editors (eg Microsoft Word) will not display spaces with uniform spacing.

For that reason, to line up text in Word, you must use tabs.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Also, if you switch to spaces instead of tabs, you won't be among the first against the wall when the anti-tab revolution comes.

I wouldn't go that far. The beauty of tabs is that you can change how much you want it to indent. For example, if I prefer a 5-space indent, and you prefer 3, I can still send you code, and you can view it to your liking based on what your editor is configured for.

They have: 5,633 posts

Joined: Jan 1970

OMG, Whats the anti-tab revolution and whens it coming?

Doesnt sound good.

I've found the "Convert Tabs into Spaces" option in my code editor which is PSpad and i clicked on it and it asked me to enter tab width for conversion which i just left as 2 and clicke ok on.

I then check the view sorce of the page and all the code is still all over the shop.

I'm really not that experienced with this sort of stuff.

Anything im doing wrong do you think?

Smiling

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Can you provide a link?

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Don't worry, am only joking about tabs. Just trolling. Smiling

It doesn't sound like you've done anything wrong. A link, as pr0gr4mm3r said, would be good.

a Padded Cell our articles site!

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Also, if you switch to spaces instead of tabs, you won't be among the first against the wall when the anti-tab revolution comes.

How quickly rumors spread....!

They have: 5,633 posts

Joined: Jan 1970

Hello,

Heres the link:
http://www.vladmihalache.com/ewriterpro/

Cheers for all your help.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Hi Vlad,

The source of the page appears to be one long line without any returns (CR/LF)

What did you use to create it?

This looks like an affiliate program, did they create the page for you?

I also noticed that you do not have meta tags for keywords or description (deprecated, perhaps, but not worth ditching altogether). A charset meta tag is generally helpful, too.

Also, no DOCTYPE declaration

The browser rending the web page will process the coding in Quirks Mode.

(maybe this is the answer - Quirks Mode?)

He has: 629 posts

Joined: May 2007

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

I looked for Tidy in the source output - I still suspect the code was auto generated another way...

They have: 5,633 posts

Joined: Jan 1970

This is a sort of sales page for an affiliate program. The only thing copied is the text within the page.

The design itself was taken from a website packadge i have and i just took that code added my pics and text.

The program i use to edit everything is PsPad.

He has: 629 posts

Joined: May 2007

Sorry Decibel.places,
"Tidy" was my answer to this:

vladmm wrote:
Im just wondering if thats a problem and how it can be sorted out if at all?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.