Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Two-level article list?

Hi all,
I've tried to read up about multi-level looping, both here and in the help file, but I always get lost halfway in. I don't think what I want is all that unusual, but I just can't seem to make it work. What I want is something like this:

<link>Apples Article</link>
  <link>Green Bananas Article</link>
  <link>Yellow Bananas Article</link>
<link>Carrots Article</link>
  <link>Small Daffodil Article</link>
  <link>White Daffodil Article</link>
  <link>Yellow Daffodil Article</link>

Anyone have any advice on how I can achieve this?

Sunday, June 22, 2003

Yes. It is easily done with keywords - one for each category.

Jorgen Brenting
Sunday, June 22, 2003

Keywords? How?

I'm afraid I need waaay more help than that. ;)

Monday, June 23, 2003

The main thing I'm having trouble with is that some articles have a category (so they need to be listed at level 2, with the category at level 1), while others don't have a category (so the article itself needs to be at level 1). Also, the category names themselves are not linked to anything; there's no 'portal' page for each category.


Monday, June 23, 2003


In the article page, look around, you will see a tab that says properties. In there you will see a section called keywords. In keywords place the  appopriate category name that applies to that article.

Then you would use cityscript code to grab all the articles that contain the category you entered in the keywords area. 

As far as what categories appear first or last you can place the cityscript code for level one articles before the code for the level two articles.

See the help file for info on cityscript code. It will tell you way more than I cacn here.

John Cesta

John Cesta
Monday, June 23, 2003

No matter how I figure it, the only way to achieve anything with keywords is to use the actual keywords in the script. When I write the script, I have no idea what the categories are; plus, I don't want to write code for every single category.

Either I'm missing something very basic, or what I want isn't as simple as I thought.

Monday, June 23, 2003

You can't write one script that will come up with a multi-tiered loop. You have to write several loops, and manually add a new loop when you add a new category.
Monday, June 23, 2003

Martha, I don't know how to write a single generic script that will do what you want. I think what you'd like is a script that you could "set and forget," that is, it would account for any articles and categories that you may need in the future.

That sort of thing may be in future of CityDesk or be accomplished via javascript. In the meantime, you can accomplish it with some brute force scripting with keywords, and / or folders for each categories. Keywords for sure if you have articles that combine apples and strawberries and Folders if your articles are "single fruit."

As for me with my scripting abilities and laziness, I'd try to avoid the "two-level" problem and meet my needs in some easier way.  Sometimes a search box is the best way to help folks find things.  My own ideas about a clearcut presentation probably aren't so clearcut to other folks.

Monday, June 23, 2003

Thanks, Mark & tk. I was trying to reproduce an existing layout (which uses frames //shudder), hoping it would make acceptance easier. If I were designing the site from scratch, there wouldn't be any categories, or there'd only be a few of them. They're not exactly helping navigation or anything, and numerous studies have found that people have trouble with multi-level navigation.

Tuesday, June 24, 2003

*  Recent Topics

*  Fog Creek Home