Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Bug: Editor trashes raw HTML?


I am using CD professional version 2.0.19.

I have one .html article in my project that I am attempting to edit. In order to give the article the same look and feel that I am giving to other pages in the project, I am trying to copy and paste some of the <BODY> tag attributes from the default template that I am using in the regular (non HTML) "articles" in the project.

What happens is: I remove the <BODY> tag that was generated by CityDesk in the .HTML file (in HTML view) and I replace it with the BODY tag (containing macros, etc) from the template. When I switch to "Normal" view and back to "HTML" view for this article, just about all the HTML boilerplate has been removed from view!

In other words (hope posting raw HTML to this board works!):

I have in HTML view:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<BODY dir=ltr style="FONT-FAMILY: {$.BodyFontFamily$} bgColor="{$.cPageBg$}" leftMargin=0 topMargin=0>

What is the deal?


When I switch to Normal View and back to HTML this turns into:


<body style="BACKGROUND-COLOR: white; COLOR: black" topmargin=3 leftmargin=3 bottommargin=3 rightmargin=3></body>


NONE of the other tags remain (DOCTYPE, HTML, TITLE, META.)

I guess I can switch out to an external editor or NOTEPAD but then I lose the previewing ability. One workaround that appears to work is to never touch "Normal" (wysiwyg) mode when editing an HTML article like this.

I did just this and generated the web site. The page was generated normally with macros expanded in the BODY tag as you'd expect.


Bored Bystander
Tuesday, January 20, 2004

You need to put the header info in a template. 

joel goldstick
Tuesday, January 20, 2004

I should elaborate.  CityDesk makes creating 'look and feel' easy by providing the template mechanism.  Within your template, after the <body> tag in the tempate, you insert {$.body$}.  Then follow it with whatever footer stuff you like and the </body> tag.

In your articles, just type the content you like for that page.  When you publish, the content in the article will appear where {$.body$} occurs in the template. 

The CD article editor will 'clean up' your article so that it is valid xhtml.  This causes people trouble because it deletes javascript, and other 'illegal' markup when the user switches to 'normal' mode, then back to html mode. 

In my view, the best thing to do is not to put javascript in your article text.  Put it in a variable, and pull it in to your template.  If you leave the article body clear of nothing but content, you make it easier to non-technical people to enter content.  They don't need to be concerned with mark-up.  Its safer that way.

Take a look at the Getting started article that comes with CD, or download some of the templates that are available at .  See how they use templates versus what is put in the articles.

joel goldstick
Tuesday, January 20, 2004

Thanks Joel,

That makes sense, and it had occurred to me after I posted this to just create a template dedicated to this purpose.

I suppose the HTML Explorer control can't think for me yet. ;-)

Bored Bystander
Tuesday, January 20, 2004

*  Recent Topics

*  Fog Creek Home