views:

57

answers:

3
+2  Q: 

Reformatting HTML

I'm not a developer so I don't know the right term for this. I am dealing with code done by other and it is coded in a continuous way. Meaning not like this,

<body>
   <ul>
       <li>List 1</li>
       <li>List 2</li>
       <li>List 3</li>
   </ul>
</body>

but instead, like this, continuously:

<body><ul><li>List 1</li><li>List 2</li><li>List 3</li></ul></body>

Now my question: is there a way or automatic way for Adobe Dreamweaver to make the second look like the first? I mean in one click it will all be indent as the first?

+1  A: 

Didn't work with Dreamweaver for years, but found this site that can help you..

Change The Code Format

Garis Suero
A: 

This looks like what you're after:

http://livedocs.adobe.com/en_US/Dreamweaver/9.0/help.html?content=WSc78c5058ca073340dcda9110b1f693f21-7bdd.html

Basically View Options --> Code View Options --> Auto Indent

SteveCav
this code is not done by me. this code is typed by a guy who can code continuously
Eron
You asked how Dreamweaver could do it. Is that what you wanted?
SteveCav
Yes. I did that but it doesn't automatically make these existing codes indent. No changes happen. It only affects the new codes that I will type but not these existing ones.
Eron
A: 

Eron, it's amazing how many people think that by removing returns and tabs you can save this massive amount of filesize and load time. It's true, you do save some....but it has about as much effect as going to the bathroom in an Olympic Swimming Pool....that is, not much.

As a UI guy, I'm obsessed with correct indentation of my code on the backend. It makes it easier to catch problems and fix them quickly. To that end, in my latest job I've been mercilessly hacking away at ugly code one file at a time, manually formatting (adding breaks and tabs) as I go. It's not quick, and definitely not fun. But the finalized code looks great. It's worth it, I think.

Dreamweaver isn't a bad tool, but there's better ones out there that will help with this task. Personally, I really like NetBeans. It'll highlight start/end tags, draw tab "lines" and even auto tab if it can. Another good one is Rapid PHP, which does this neat "block tab" tool for similar lines of code like you mentioned above. If you're newer to HTML, both will auto-suggest and validate your code on the fly and show you what's wrong.

If you want to get really crazy, you can control the tabbing and breaks on outputted code. \t is a tab, \n is a line break. If you're doing work on dynamically created multi-level unordered lists such as a menu, it can really help.

Good luck, keep learning!

bpeterson76