How to clean up messy table code

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

How to clean up messy table code

Post by TJINAK »

Thank you for reading,

I'm working on moving a site into cmsms.  This old site has lots of tables with messy code.  Here is an example:

Code: Select all

<tr>
            <td valign="top" width="60">
            <div align="left"><font size="4"><strong>0.52</strong></font></div>
            </td>
            <td valign="top" width="360">
            <div align="left"><font size="4"><strong>Building lot on Ninilchik Drive.</strong></font></div>
            </td>
            <td valign="top" width="72">
            <div align="left"><font size="4"><strong>$7,000</strong></font></div>
            </td>
            <td valign="top" width="120">
            <div align="left"><strong><a href=""><span><font size="4">07-15674</font></span></a></strong></div>
            </td>
        </tr>
I'm going to do the formating with CSS so I need nice clean code like this:

Code: Select all

 <tr>
            <td>0.42</td>
            <td>Res. Building lot on Alaik Drive.</td>
            <td>$30,000</td>
            <td><a href="">SOLD</td>
        </tr>
I'm currently deleting the messy code by hand, very time consuming anyone have suggestions on how I can do this in a more productive manner, without having to retype the data in each row?

Thank you,
TJ
Jack @ PharSide

Re: How to clean up messy table code

Post by Jack @ PharSide »

Try a "search and replace" within Dreamweaver, TextPad or Notepad. Since all TD are the same (with a few sizes differences), simply search and replace each table data tag with individual sizes.

Like this:

Search for:
Replace with:

Obviously do this for each TD tag that is different. You can also do the end of a TD tag as well.

If you wanted to get rid of the text formatting as well:


Search for:
Replace with:
Pierre M.

Re: How to clean up messy table code

Post by Pierre M. »

May be tidy or a similar tool can help you.
Pierre M.
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

Re: How to clean up messy table code

Post by TJINAK »

Is it possible to integrate tidy with cmsms?
Pierre M.

Re: How to clean up messy table code

Post by Pierre M. »

I think what you are looking for is cleaning existing material before you put it inside CMSms (as Jack as suggested too). There is mod_tidy to integrate tidy with Apache v2. wget cleaned material then put it in standard CMSms.

Pierre M.
Post Reply

Return to “Layout and Design (CSS & HTML)”