Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Archive List Revisited

No one has bothered posting any thoughts to my request for help on creating an archive list, so I thought I'd try it one more time.  All you die-hard CD users out there:  anyone care to chime in?

http://discuss.fogcreek.com/citydesk/default.asp?cmd=show&ixPost=8615&ixReplies=0

George Illes
Friday, August 15, 2003

Joel has it. You basically have to add a new script every month to do what you want. Not automatic. There may be CityScript in the future that will allow a single script to do it but not yet.  Folks might have figured out how to do it in JavaScript.

So, for every month in your archive page you'll add something like this (presuming the articles you want are in a folder named "blog")

<p>August, 2003</p>
{$ foreach x in (and (folder "blog")(and(after 2003/07/31)(before 2003/09/01))) SortAscendBy .fileddate $}
<p><a href="{$x.link$}">{$x.headline$}</a>
</p>
{$ next $}

Next month, copy the script, change the month title , change the before and after dates and you're done.
Please pardon me if I don't have the ()'s exactly right but once you get one of these working you're all set.

tk
Friday, August 15, 2003

tk, thanks much for the help.  Too bad there's no way with city script to generate a series of linked headlines below each month!  t'would be useful.

George Illes
Friday, August 15, 2003

Once you get one to work, it just takes a couple of minutes a month but you've gotta remember to do it.

tk
Friday, August 15, 2003

I'm trying another way...

Using (thisFolder), set up a file that I put in each month subdir (\root\blog\2003\{month}). Here's the html for \root\blog\2003\{month}\list_of_entries.html:

<table cellspacing="0" cellpadding="0" width="100%" border="0">
  <tbody>
{$ .data_separation_row_3_columns $} 
{$ foreach bal in (and (thisFolder)(not(keyword_contains "(nonblogentry)"))(not(thisArticle))) SortDescendBy .fileddate $} 
    <tr>
    <td align="left" width="20%"><a class="tablelink_bob" href="{$bal.link$}">{$ setDateTimeFormat "English" "dddd dd" "hh:mm" $}{$bal.fileddate$}</a></td>
    <td width="1%">&nbsp;</td>
    <td align="left" width="79%">{$bal.about$}</td>   
  </tr>
{$ .data_separation_row_3_columns $}
$ next $}
  </tbody>
</table> 

\root\blog\2003\{month}\list_of_entries.html have the keywords "list_of_entries" and "2003".

Then I have one ARCHIVE.HTML page that lists all the LIST_OF_ENTRIES.HTML files in \root\blog\2003. The essential ForEach loop I use is:

{$ foreach x in (and (keywordContains "2003")(keywordContains "list_of_entries")) $}
  <a class="tablelink_bob" href="{$x.link$}">{$ setDateTimeFormat "English" "MMMM" "hh:mm" $}{$x.fileddate$}  </a><br />
{$ next $}


Note that the individual \root\blog\2003\{month}\LIST_OF_FILES.HTML have exactly one line in them:

{$ include "generic_files/list_of_entries_template" $}

Yeah yeah I coulda used a template. I like to use as few templates as possible.

Every month I copy paste, and every year I set up a new chart in ARCHIVES.HTML.

-Bob

Bob Bloom
Monday, August 18, 2003

Bob,

Thanks for sharing your method!  I'll try to give it a whirl.

George Illes
Tuesday, August 19, 2003

Excellent Bob.

tk
Tuesday, August 19, 2003

*  Recent Topics

*  Fog Creek Home