Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

The variable .body is defined in terms of itself..

I get this error when doing the following:

- I have a template that uses the include tag to pull in some other CityDesk articles.

- One of those included articles contains the {$.body$} variable.

If I prevent the included article from being published by itself (Never Publish After), the error doesn't happen, but the article doesn't get included.

This syntax works for all the other variables, it's just .body that's throwing it off.

Is this possible?  I know you can do this with variables, but I'd like to avoid that if I can.

Thanks,

Dan Novak

Dan Novak
Thursday, February 12, 2004

a .body tag should only be in a template.  Them template describes the over all structure of the page.  The article specifies a template and the parts of the article (body, headline, etc. ) are the bits that the template can "paste" in to its structure.  What you are doing is the same as having a .headline tag inside a headline, or .teaser inside the teaser.  A thing can't be inside itself.  It will recurse forever.

The $include directive will insert the body of the article you specify.

Maybe you can post your template and tell us what you are trying to do?

Its confusing at first, but it gets easy soon

joel goldstick
Thursday, February 12, 2004

A similar problem was stumping me today and I think I've figured it out, thanks to Darren Collins' helpful info on fragments (http://citydesk.pool-room.com/ContentFragments.html) and the CD documentation on include statements.  Perhaps someone can correct me if the following is faulty since I'm not working on a live site yet, and I'm a newbie at CD.

The article (fragment) to be included in another article has to be "publishable".  It won't be included if the publish before/after boxes are checked.

A blank template will prevent the included article (fragment) from being published, actually it will load a blank file (I think?)

The default for a new template includes the body variable.  If this is not removed, the article (fragment) will be published.  If it is removed, the article can be included in other articles, but will not be published to the site.

Kay Dee
Friday, February 13, 2004

Thanks, I think Kay Dee nailed it: I want to include an article in a template where this included article contains a {$.body$} tag, but I don't want the article published on its own.

If you're curious, I'm developing template families render content for different browsers, namely the PDA.  I wanted to keep each "snippet" in a separate includes folder so I could easily edit the templates without having to figure out the name to use.

For example (replaceced angle brackets):

[HTML]
[!--
    A page that is a "child" of another page.
    The headline acts as a back button.
    TODO: Figure out how to return to a parent if a leaf has multiple parents.
--]
    [HEAD]
        [title]{$.headline$}[/title]
    [/HEAD]
    [BODY BOTTOMMARGIN="0" TOPMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" TEXT="black" LINK="#003399"]
        {$ include "Includes/PDA/navNexPrevUp" $}
        {$ include "Includes/PDA/hdrMainLinked" $}
        {$ include "Includes/PDA/hdrTeaser" $}
        {$ .bodyPDA $}
    [/BODY]
[/HTML]

This lets me replace "/pda" with another include folder when I make a new template family.

I've gotten around this for now by using variables containing the body tag.  I'd really like to be able to do this with includes though, just for consistency.

I'll try it with the empty template and let you know what happens.

Thanks,

Dan Novak

Dan Novak
Friday, February 13, 2004

Dan,

I loaded the CD version of my site into a test directory and the blank template worked.  Better than expected, actually.  The Internal folder that contains all the fragment files with blank templates was ignored on Publish.  The fragments appear where they're supposed to within files that were published.

This is sweet!

Kay Dee
Sunday, February 15, 2004

Dan, <angle brackets work fine in this forum> ;)

www.MarkTAW.com
Monday, February 16, 2004

*  Recent Topics

*  Fog Creek Home