Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

all articles in current folder?

My web site has a fairly deep directory structure. (Perhaps it should not, but that's a discussion for another time.) Each directory has an index.html in it, plus a varying number of articles.

I want to create a single template for all my index.html that contains something like

{$ foreach x in (and (folder ".") (not (filename "index"))) $} stuff...
{$ next $}

so that a given index.html will be automatically updated whenever an article is added to that directory.

I can't hard-code folder names in the foreach loop, because the template will be used for index.html in several different directories.

I can't use article keywords, for the same reason.  (And anyway I'd always be forgetting to set them for new articles.)

Can I tell (folder "") to look in the current folder?

Pat Rice
Thursday, October 24, 2002

Short answer is: no or at least not yet.

This was a much requested feature early on, being able to specify somthing like "this_folder" in a script. It would be a great feature for your problem though.  There have been requests for "this_folder_and_its_subfolders" too.

For the time being you'll probably need to do it with Java script (Adriaan, help) or by sticking the specific scripts in the body of your index files.  It's just a little extra work per folder but you can get it done that way.

Thursday, October 24, 2002

If I understand your question, I'm kind of doing the same thing now. I've got an article_index template that I use throughout the site. In each directory I create an article that uses this template, and then in the body of the article I insert the absolute foreach statement. It's not completely generic, as you're asking for, but it's fairly close, i.e, I can update the template globally. I just copy and paste the code over, update the folder name, and that's it. But I agree that what you're asking for is a worthwhile enhancement for the next version.

Scott McDonald
Friday, October 25, 2002

It is possible with javascript; you'd need to generate all required article field info into a javascript array and then write it to the document by function.

- search engines won't see it
- browsers with disabled javascript won't see it.

PHP/ASP don't have this limitation (but require more from the server).

I would prefer a FogCreek solution, but I don't know how long we'd have to wait until CityDesk 2.0 which solves all problems and limitations ;-)

Adriaan van den Brand
Friday, October 25, 2002

*  Recent Topics

*  Fog Creek Home