Forum Moderators: open

Message Too Old, No Replies

cleaning up an old site and adding DOCTYPE

         

esllou

3:19 am on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a 2000 page site from 2001 which is basically table based with some CSS prettying up.

Now, not one single page has a DOCTYPE and I want to rectify this situation.

I know it will be messy with lots of code blood spilt liberally everywhere...I already had a peek at one page with the DOCTYPE added and it was very nasty!

what is the least painful way to go about this? I want good clean code with, as an absolute minimum, that it looks the same in IE, FF and Opera.

What prompted me this evening was finding out that all my css class="1" statements were showing fine in IE but not at all in FF. w3c says you shouldn't use numerals in class selectors and IE, in its quirky way, was showing all those tables fine. When I added DOCTYPE to the page, even IE stopped showing them.

so, I need to clean the site up.

any advice?

BlobFisk

9:14 am on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi esllou,

My advice is to run your HTML and CSS code through the validator as often as possible and always use a doctype! ;)

In this case you need to change the name of your class to male sure that it doesn't start with a numeral. A search and replace across your files for class="1" should do the job. Then change the class in your CSS and things should start working!

HTH

encyclo

1:25 pm on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On old pages like this, there will be a lot of the design which will be dependant on quirks mode handling by the browser. If you add a full doctype you'll trigger standards compliance mode which will just make things harder. When converting older markup but retaining the basic tables-based structure and styles, I use a half-doctype to allow validation whilst keeping quirks mode:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

The half-doctype shouldn't be used for new documents, but is the best solution here. Once everything's validated and corrected, then you could try switching to a full doctype - but you might not think it's worth it.

After that, I usually use gobal search and replace to make site-wide corrections (as in your example of the class names with numerals). I also introduce PHP includes or at least SSI to simplify future management.

If the markup is really bad, though, sometimes it is quicker to recreate the design using proper standards and rebuild the site from scratch. Obviously, you need to keep the file names the same whatever you do.

esllou

3:26 pm on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks for the replies.

I do want to clean the site up to make it cross browser friendly and better to edit in the future and hopefully help on the search engine side of things too.

I already use SSI which should cut down on a lot of search and replace, but not all. It's basically a solid two days of work.

my style sheets are full of things like

font-size:13;

not px, or pt, or em or anything, just 13!

quirks mode will sort that out but it dies a death when I put a doctype onto the page! haha!

busy couple of days ahead....

Farix

3:55 pm on Mar 15, 2005 (gmt 0)

10+ Year Member



This looks more like a site redesign, even if the new design is going to look almost exactly like the old to the user.

What I would do is create a new site-wide template using HTML 4.01 Strict and CSS. Once that's done, all that is left is to copy & paste your content from the old design to the new. Since you have so many pages to redo, I would look at getting some help with the copy & paste part. I would also divide the pages in groups depending on how the pages relate to each other and work on each group individually.

esllou

9:59 pm on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



farix, what do you mean by "getting some help" with the copy and pasting?

do you mean in the olde worlde sense of getting help or using a script of some description?

and, yes, what you said about redesigning the site is pretty much what I had decided needed doing....otherwise, I will be back doing another "clear up" 18 months down the line....better to bite the bullet now and be done with it.

Farix

2:07 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



I mean "lackeys doing the grunt work" kind of help. ;)