Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Minor bug in default template

Create a new site and open up the "Simple" template.

Line 33-35:
{$ if nonblank .headline $}
<p><em>{$ .about $}</em></p>
{$ endif $}

I suppose line 33 should be:
{$ if nonblank .about $}

Henrik Jernevad
Wednesday, August 27, 2003

It looks weird but it's actually on purpose. That's a little trick we used so that the Index article itself (which doesn't have a headline) can use the same template as all the articles do, without having any "about the author" section.

Joel Spolsky
Wednesday, August 27, 2003

Oh.. cool. =)

Although, it really should check that both headline and about are nonblank, shouldn't it? But that's not possible in CityScript right now, perhaps.

Henrik Jernevad
Wednesday, August 27, 2003

That's definitely possible...

{$ if nonblank .headline $}
{$ if nonblank .about $}
<p><em>{$ .about $}</em></p>
{$ endif $}
{$ endif $}

since its nested the html will only appear if both are nonblank

Michael H. Pryor
Wednesday, August 27, 2003

Ohh.. once again, cool.. =)

I thought nested conditionals wasn't allowed. But perhaps it's only foreach:es that aren't possible to nest.

(Preparing to say "Oh, cool" once again, if I'm proven wrong one more time ;) )

Henrik Jernevad
Wednesday, August 27, 2003

forEach's can nest, too.

You just can't use the result of the outer forEach to decide which articles to include on the inner forEach, which makes this feature rather less useful.

Joel Spolsky
Wednesday, August 27, 2003

*  Recent Topics

*  Fog Creek Home