Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

variables and loops

I want the foreach loop inside the article, and use the {$x.*$} values inside some variable. I get errors telling that {$$} doesn't exist. Why?

{$foreach x in (and (folder "test/faq") (keyword_contains "proces"))$}
<A href="{$$}">{$if nonblank x.teaser$}<ACRONYM title="{$x.teaser$}">{$x.headline$}</ACRONYM>{$endif$}{$if blank x.teaser$}{$x.headline$}{$endif$}<BR>{$next$}

I wanted to place the <A ... </A> part inside a variable .TeaserLink, which didn't work.

By the way: the <acronym> is a nice trick to get tooltips in Internet Explorer which can contain a whole teaser. It only works if you don't use HTML tags and " inside the teaser.

Adriaan van den Brand
Friday, September 13, 2002

Yeah, that won't work.

I suspect it's to do with the order that CityDesk injects variables into articles and parses the CityScript. If it tries to parse the variable before injecting it then it won't be able to see the for loop bit and thus the {$x.*$} bit won't make any sense to it.

If that makes any sense...

John C
Friday, September 13, 2002

I'd really like this to work....

{$foreach photo in (keyword_contains "photograph({$.extra1$})") $}

so that I could create an index file that goes off and finds all the files that it should index...

Unfortunately, nothing is found... although if I place a comment above the loop of --(keyword_contains "photograph({$.extra1$})") -- then the field name is expanded as desired.

Any chance of getting this  to work?

Andy Hardy
Wednesday, September 25, 2002

*  Recent Topics

*  Fog Creek Home