Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Paragraphs and {$ .body $}

I'd be interested to know if people wrap the {$ .body $} field in their templates in <p> tags or not. I ask because I'm getting some problems with orphaned paragraph tags.

John Topley (
Tuesday, June 3, 2003

No, My body is always in a <TD> so I just define TD and P as the same in my style sheet.

I am interested in the possibility of getting rid of tables altogether though... Just took a peek at the Opera homepage and look ma, not tables. I need to read up on CSS.
Tuesday, June 3, 2003

You go Mark!

Joel Goldstick
Tuesday, June 3, 2003

John, I usually do the following:


which balances the paragraph tags and preserves the layout in browsers.

Go for it Mark, but be prepared for cross-browser incompatability problems galore!

John C
Tuesday, June 3, 2003

Thanks John, that's a pretty cool workaround. I did have a look at the listing you give on your backend page but that doesn't have the doubling up of the tags.

The Opera home page is impressive - if you're only targetting newer browsers.

John Topley (
Tuesday, June 3, 2003

That's because I always like to keep the really cool stuff to myself! Actually, I just published my templates before I came up with that trick.

John C
Wednesday, June 4, 2003

A comment on the way CityDesk does paragraphs...

If a field (including the body field) contains exactly one paragraph, CityDesk will not put <p>'s into it. That is so that you can do things like have use the {$.headline$} as your <title> without getting <p>'s in it.

If a field contains more than one paragraph, CityDesk will keep the paragraph tags, and all tags will be closed. So you'll get <p>Para1</p><p>Para2</p> etc.

One problem with this system is that if you build your templates to assume that they're getting multiple paragraphs, and a particular story winds up with only one paragraph, it comes out looking strange.

I personally fix this by adding two <br>s manually to the end of any one-paragraph articles. (Using Shift+Enter to create the <br>). Somehow this makes them look right in a template that expects multiple paragraphs.

This is a little bit hacky. In a future version of CityDesk, post 2.0, we hope to let page designers choose whether a given field is multi-paragraph or non-paragraphed. Ach, life was better in HTML 1.0 when everyone misinterpreted <p> as being a paragraph separator.

Joel Spolsky
Thursday, June 5, 2003

Thanks Joel, that explanation is helpful.

John Topley (
Thursday, June 5, 2003

*  Recent Topics

*  Fog Creek Home