Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Order in which variables are processed

Hi all,

I think I know the answer to this already, but just want to make sure I'm not overlooking something with my non-programmer brain.

The following variable executes properly:

{$ foreach x in (author "Scott McDonald") sortDescendBy .filedDate $}
<p class="plist"><a href="{$$}">{$ x.headline $}</a>&nbsp;&nbsp;|&nbsp;&nbsp;{$x.filedDate$}</p>
{$ Next $}

Since I have dozens of author articles and the presentation is subject to change, I tried to turn this all into a variable, which required capturing the author name as a variable, so something like:

{$ foreach x in (author "{$.author$}") sortDescendBy .filedDate $}
<p class="plist"><a href="{$$}">{$ x.headline $}</a>&nbsp;&nbsp;|&nbsp;&nbsp;{$x.filedDate$}</p>
{$ Next $}

This won't run, presumably because everything gets processed from left to right, so the nested author variable gets resolved AFTER the foreach loop, causing the whole thing to fail (if that made sense). Hope I'm wrong and doing something stupid. But if not, and you understand what I'm trying to do, do you have any ideas for workarounds?

Thanks in advance for you help.

Scott McDonald
Wednesday, October 15, 2003

It's actually simpler than that.  You can't have a variable INSIDE a cityscript tag.

Michael H. Pryor
Wednesday, October 15, 2003

doh! How did I manage not to stumble on this one earlier? :-) Thanks, Michael.

Scott McDonald
Thursday, October 16, 2003

*  Recent Topics

*  Fog Creek Home