Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Variable expansion in article.body

I'm having a problem with variable expansion in articles.

I have a master article page that is created by looking for articles with specific keywords. The basic loop for the master page is:

{$foreach x in (keyword_contains "foo") SortAscendBy .headline $}
  {$x.headline$} {$setDateTimeFormat "English" "dd MMM, yyyy" "hh:mm"$}{$x.filedDate$}
  {$x.body$}
{$next$}

Notice that the body of the article is shown on the master page, not the teaser.

An article as simple as:

  {$.SiteName$}

shows up as

  Blah
  {$.SiteName$}

on the master page. But if you look at the article page itself, you see:

  Blah
  My New Site

Any pointers? Is this a bug or is it expected results?

Thanks!

- Peter

Peter Kropf
Wednesday, December 26, 2001

I copied your script and tried the same thing.  It worked perfectly for me.

This was my article with keyword "foo":

blah
{$.SiteName$}

This is how it came out in preview:

blah
Ivory Tower Ignorance

TK
Wednesday, December 26, 2001

Is your master page an HTML file?

Or is it itself an article?

Unfortunately currently we only evaluate CityScript two levels deep. So if the master page is an article using a template, where the body of the article itself contains CityScript, and that CityScript itself resolves to something that includes CityScript, now we're talking 3 levels deep and we don't evaluate it.

For now the easiest workaround is to make the master page an HTML file, or don't use variables down there at level 3.

We'll fix this for the first service pack (real soon now!)

Joel Spolsky
Wednesday, December 26, 2001

The master page is an article using a template and the body that's included has CityScript. So it looks like it hits the > 2 level deep issue.

I'll keep my eye out for the release of the service pack and see how things sit after that.

- Peter

Peter Kropf
Thursday, December 27, 2001

*  Recent Topics

*  Fog Creek Home