Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Two levels of links = infinite loop error

I'm getting an Infinite Loop error when I try to create two levels of links. Here's the code:

I create a listing of links on an index page of all articles in a folder, like this:

{$ foreach x in (folder "Recreation_Classes") $}
<a href="{$$}">{$x.headline$}</a>
<br /><br />
{$ next $}<br />

That works fine; however, there is also a sub-folder in the Recreation_Classes folder called Swimming_Classes which contains several articles, so one of the articles in the Receration_Classes folder has the following virtually identical script :

{$ foreach x in (folder "Recreation_Classes/Swimming_Classes") $}
<a href="{$$}">{$x.headline$}</a>
<br /><br />
{$ next $}<br />

When I try to Preview, I get an Infinite loop error. Anyone any idea how to work around this so that I can create multiple levels of links?

Any help as always greatly appreciated,


Wednesday, February 11, 2004

Try using different variable names in the two loops. For example, x in the outer loop and y in the inner loop.

Joel Shprentz
Wednesday, February 11, 2004

*  Recent Topics

*  Fog Creek Home