Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Any ideas for how to do a weekly calendar view?

... e.g. in each table row, one week starting Monday, and in each table cell, articles of that publishdate.

I'm stumped, beacsue ISTM it needs a foreach condition with as-yet-unsupported arithmetic.

Thanks.

------

BTW, anyone else noticed this forum drops leading spaces, such as this:

this line was written starting with a space.

It is a phpBB app, perhaps? ;)

Chris John Jordan
Saturday, March 23, 2002

I noticed that the forum drops leading spaces, but then so does HTML. The source code reveals a space.

Do something like:

first row: (and (after today) (before today +7) )

second row: (and (after today +8) (before today +14)

Basically it's:

first row: everything after today, but before 7 days from now

second row: everything after 8 days from now but before 14 days from now.

And always publish FOR monday.

Mark W
Saturday, March 23, 2002

that should be "publishdate" not "today".

This code works, and does what you want. remember to publish for Monday always.

<TABLE border=1>
<TR>
<TD>monday<BR>  {$foreach x in (publishdate) $}  {$x.headline$} {$next$} </TD>
<TD>tuesday<BR> {$foreach x in (and (after publishdate) (before publishdate +2)) $}  {$x.headline$} {$next$} </TD>
<TD>wednesday<BR>  {$foreach x in (and (after publishdate +1) (before publishdate +3)) $} {$x.headline$} {$next$} </TD>
<TD>thursday<BR>  {$foreach x in (and (after publishdate +2) (before publishdate +4))$}  {$x.headline$} {$next$} </TD>
</TR></TABLE>

You'll have to extrapolate out to fit your needs.

Mark W
Saturday, March 23, 2002

Well yes, instead of the foreach week loop I can hand-code each week individually, but I was looking for a script to cover any week(s).

Chris John Jordan
Saturday, March 23, 2002

Uh... okay. Perhaps a better description of your problem would lead to better solutions.

I know that came off as rude... I'm very tired, so take the tone with a grain of salt.

Mark W
Sunday, March 24, 2002

My reply gives 'Connection closed by remote server'.

Chris John Jordan
Sunday, March 24, 2002

Trying IE instead of Opera...

> take the tone with a grain of salt.

No problem - so taken!

> Perhaps a better description of your problem would
> lead to better solutions.

OK. As designer I want to create a *.cty having a weeks-as-rows event calendar with cells-as-days each of which links to the articles each covering an event on that day. The user supplies the articles and publishes.

I accept your proposal that the designer could hand-code each week - I was hoping to get CityDesk to loop around week-generic code. I accept your proposal that the user could publish always for Monday, but this would need the user to publish seperately (by seperate *.cty's) the calendar and the rest of the site, to avoid interference with dependencies of the standard publish date.

Both are acceptable, but I'd be interested to know if there were any better solutions still using only CitySite. Thanks.

Chrisj John Jordan
Sunday, March 24, 2002

Here's a strategy that might work. I haven't tried this, but it might be worth a shot:

1. Create a new template family.
2. Create a template for your calendar pages.
2a. Make all the other templates in the calendar family output blank pages.
3. Create the calendar article based on that template.
4. Define a new publish location that only publishes the new template family.
5. Zap all of the files that get published besides your calendar files?

Yes, this is an unintended, strange and horrible use of template families. And it does require some extra work (getting rid of the extra files that will probably be published), but you might be able to make it work. If you attempt this, let us know how it goes... ;)

Brian St. Pierre
Tuesday, April 02, 2002

A better strategy might be to use audiences in a (more or less) similar manner. This might be more straightforward.

Brian St. Pierre
Tuesday, April 02, 2002

*  Recent Topics

*  Fog Creek Home