Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

foreach in folder except current file

How?  I'm trying to create a navbar with links to other pages *except* the page I'm currently on.  Here's a snippit that doesn't work:

{$ foreach x in (and (folder "SubHomes") (not((filename ".filename"))) ) $}

{$ next $}


Mike Kolter
Saturday, December 21, 2002

I don't believe anyone has found a way to do directly within CityDesk.  I think some folks have done it with Java script.

Loot at Adriiaan's method:

"More on Navigating with Java script.  The Java script that allows you to generate breadcrumb type links.  .cty Download - Using Java script to manage navigation a zip file  (this is the new July 7, 2002 file)- The archive contains the naviation system (in top of each page with links to folders higher up) and some dynamic form. I guess good use of foreach. I've quickly translated it to English. Hope it is useful. Best regards, Adriaan van den Brand."

under ".cty downloads"

Saturday, December 21, 2002

This is easy with SSI, providing your host supports it - something like :

{$foreach x in (folder "foo")$}
<!--#if expr=" '{$x.filename$}' != '{.filename$}' " -->
<a href="{$$}">{$x.headline$}</a>
<!--#endif -->
{$ next $}

should work. See for SSI documentation.

Michael Wild
Thursday, January 2, 2003


{$foreach x in (and (folder "Links") (not keyword_contains "(NFP)")) SortDescendBy .Headline$}
<A href="{$x.teaser$}" target=_blank>{$x.Headline$}</A>&nbsp; {$x.Sidebar$}<HR>

The File of (files) that YOU DO NOT WANT PUBLISHED, put "(NFP)"  as a Keyword.

I pick up this technique from The non-profit CD cty.

Walter Matte
Friday, January 3, 2003

*  Recent Topics

*  Fog Creek Home