Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Loop pulling wrong articles

Problem: Loop pulls articles not specified and does not pull articles expected.

Abbreviations:

art = Article
dir = Directory
kw = keyword

Directory Structure:

dir.CDTech
  art.index(toc) kw._index
  art.New Article kw._other
  dir.Web
      dir.Questionnaire
        art.index(this) kw._index
        art.Demo
      dir.Stuff
        art.index(this) kw._index
        art.keywords

Loop for index(toc):

{$ foreach x in (and(folder "CDTech/*")(keywordContains "_index")(not(thisArticle)))$}
<a href="{$x.link$}">{$x.headline$}</a>xxx
{$ x.body $}
{$ next $}

Loop for index(this):

{$ foreach y in (and(thisFolder)(not(thisArticle)))$}
<a href="{$y.link$}">{$y.headline$}</a><br />
{$ next $}

What I expected to display is this:

  Questionnaire

        Demo

  Stuff

        Keywords

What I get is:

  Questionnaire

        New Article

  Stuff

        New Article

I've deleted the existing XML and republished, just in case some reference got messed up.

I don't understand how the New Article gets pulled into the loop at all. When it first happened, the New Article didn't have a keyword, so I added the keword _other just in case.

Any and all help appreciated.

Amos
Saturday, September 20, 2003

It's because you are putting x.body in the TOC article.  CityDesk doesn't do scripting like a programming language, it does it by subsitution.  So first it substitutes your index(this) code into the TOC article then it evaluates it.  This makes the references to thisFolder totally different than what you want.

cd newbie
Saturday, September 20, 2003

Thanks. That clears it up.

Amos
Saturday, September 20, 2003

*  Recent Topics

*  Fog Creek Home