Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Can I use fields in foreach statements?

Reading other posts, I suspect the answer is no, but... Any way to use fields to drive conditions on foreach statements?

For instance, I'd like the content of the extra 1 field to drive a "foreach x in (keyword_contains("{$ .extra 1 $}")" statement to allow related material to be automatically listed.  This would be a way to remove self references from the result -- for instance "foreach x in (and (keyword_contains "foo") (not (filename "{$ .filename $})))"

Has anyone else had any success is creating lists of articles using the keywords without hardcoding it?  Currently, the only way I've figured out how to do it is using different templates for each subject.

Thanks in advance,
Rob Purser

Rob Purser
Thursday, April 18, 2002

Rob. the short answer is no, and there's a very logical reason for it, but it gets involved. There's a thread on it somewhere around here if you can find it.

A workaround is to use multiple templates, but create a set of articles that you treat as objects to be brought into different locations in the template - you can have 3 navigation articles. In the template you'd put {$.extra1$} and extra1 would be a foreach bringing in the appropriate template...

There was a more elegant solution than what I just said, but I don't recall at the moment.

Mark W
Thursday, April 18, 2002

*  Recent Topics

*  Fog Creek Home