Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

[Bug-2.0.17]Text zapped b/w normal and html mode

I bought the home edition yesterday [1.0 + upgrade patch to 2.0.17].

My templates going haywire till i finally tracked the problem down. I have two templates - one for the front page and one for all the inner pages. They both have a common page top(with the html head, menu etc.) and a common bottom. SO I broke the top and bottom into two articles, and am including them {$include$} in the templates. The top part of the page is stored in an article with the content given below. When i open up this article, it opens in html mode. If i switch to the normal mode and come back to html mode, the top of the page with the html head and stylesheet includes disappears!!!! So if i work in the normal mode and come back to the html mode and save it .. zap! all the pages are screwed up because the stylesheet <link rel=...> is zapped out!

I have reproduced the problem by creating a new article, and using the following content at .

Save the article, and open it up again. Go to normal mode and then back to the html mode and look at the top of the file ...

My guess is that this has something to do with CD trying to clean it up .. like make the file xhtml compliant even if it is partial content.

Sandip Bhattacharya
Thursday, August 7, 2003

Umm. Now that i think about it, is this a feature and not a bug? Am I supposed to keep partial files out of the article system in different non-html file extensions??

But I wanted to edit them using citydesk!!!!!

Sandip Bhattacharya
Thursday, August 7, 2003

This is because you are trying to put a partial page into the WYSIWYG html editor.  It will always try to create a valid page out of the HTML if you try to view it in the WYSIWYG. 

You should keep all "partial" html snippets out of articles unless you are going to edit them only in HTML view.  Use variables instead for this.

Michael H. Pryor
Thursday, August 7, 2003

Sorry for that d-uh newbie bug report. Have never used a WYSIWYG editor before. CD is my step out of hand-coding land.

The problem with using variables is that i dont have a syntax highlighted editor for editing variables. :)

I am curious about the logic used by FC folks for creating valid html though. I expected the valid page to have extra BODY, HEAD and HTML tags at the bottom.

Most of the HTML cleaning engines that I have used add extra tags to make it proper html .. I have never seen them zap out content to make it proper html. That isn't very nice.

Sandip Bhattacharya
Thursday, August 7, 2003

If you put your code into an HTML file in CityDesk, it wouldn't zap it out... but since its in an article, it does get zapped out because articles are not full pages.  They are pieces of pages that get wrapped in templates. 

And so the only things that can go into an article is whatever can go INSIDE a <body> tag (not outside a body tag).  Just think of the article as already having a built in <html><body> at the top and a </body></html> at the bottom.  HTML files on the other hand are blank slates.. you can put whatever you want in them.

Michael H. Pryor
Thursday, August 7, 2003

Thanks! Now I get it. I should have be using HTML files for partial fragments of the page ...  What you say makes a lot of sense.

However, I haven't seen anything yet in the documentation which says what can or cannot go inside the article body. Or maybe I might have just ignored such an information while skimming through the docs.

Sandip Bhattacharya
Thursday, August 7, 2003

while we're on the topic, how does one use the {$ include $}?

i've tried before creating an .html called "header.html" in the root dir, and calling from the template {$ include "/header.html" $} and it quite mysteriously didn't work.

any ideas?

john doe
Friday, August 8, 2003

:re how does one use the {$ include $}?

The way I use {$ include $} is as follows;

{$ include "folder/article" $}

where "folder" is the CD container that holds the "article".

I use "folders" because I like "order" or organization. :-)

One crates folders in CD and then one places relevant articles in those folders.

Also I strongly advise to RTFM. :-)

David Mozer
Friday, August 8, 2003

I'm sorry about that last one.

I had similar trouble-- except that it didn't need {$ include $} to happen. switching between HTML and Normal view while template editing would strip all the <head> contents (that is, mainly the CSS link).
so i thought $include would help. i forgot that using the file's name isn't the thing to do in CD. magic-copying the file's name solved to problem. sort'f. except that it didn't, because CD would keep on causing the same trouble. eventually i ended up using a variable, but it's quite a nuisance (lack of proper editing, no ability to copy files' magic names', etc.).

thanks anyways.

john doe
Friday, August 8, 2003

*  Recent Topics

*  Fog Creek Home