Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

How to evaluate a variable in a loop

I would like to create a menu loop that creates a top level menu and for a designated page create a submenu based on the aritcles in a folder. 

Example:

I have to article channels "Main and News".  It is easy to prepare a script to write the top level menu -  (I desingate "(1)" as a keyword filter top level articles)


{$foreach x in (keyword_contains "(1)") $}

  {$x.headline$}

{$next$}

For each top level article (ex: Main), there is a folder  (Main1) that contains second level article.  Here is my challenge.

Can I determine during the loop, what the name of the article is and use that to in another loop to create a list of articles in the corresponding folder?

Main
    Main1 article
    Main1 article

logic :

Loop through top level article
  - get article filename, title and link
          if article filename = 'Main'
                loop through folder 'Main1'
                      get article filename, title and link
                next
next         

Any ideas?

Daniel Mathieux
Tuesday, May 06, 2003

This is a problem " if article filename = 'Main' "

Sounds like you just need to create seperate loops for these tasks. One to stick in the Main files, one to stick in the other files.

www.marktaw.com
Tuesday, May 06, 2003

Nested loops don't seem to work with CityScript. Neither does using a variable or article field in a condition in the way you're talking about. It would be nice, though, wouldn't it?

Darren Collins
Tuesday, May 06, 2003

*  Recent Topics

*  Fog Creek Home