Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Feature recent article, easy; recent photo, hard

CityDesk makes it easy to feature the most recent article on, for example, the home page:

{$ forEach 1 x in (all) sortDescendBy .filedDate $}
<h2><a href="{$x.link$}">{$x.headline$}</a></h2>
<p>{$x.teaser$}</p>
{$ next $}

It seems very difficult to feature the corresponding thumbnail image.

Which thumbnail?  An article might have several images. Perhaps the thumbnail image name could be saved in an extra field. Or perhaps the featured thumbnail could always be given the same name.

How large? HTML img tags should include the image width and height. CityDesk knows this information, but provides no access via scripting.

Alt text? Some meaningful text should be associated with the image.

Perhaps version 3 will improve support in this area.

Joel Shprentz
Sunday, September 14, 2003

If the extra fields of an article supported HTML View, this sort of thing would be easy.

Pat Rice
Monday, September 15, 2003

I do this very thing but it's not automatic:
http://tk-jk.net/euphonic/ and
http://ahoy.tk-jk.net

Both have thumbnails on the home page and a bigger pictures in article

I plan for it when I get the pictures. The orginals are always too big both in bit size and actual size. So I run them through Photoshop Elements, size them, dropshadow them, save them in a lower resolution. Then I run them through "Easy Thumnails" to make a thumbnail. I drag the "big" image and the thumbnail into CityDesk, put the big picture in the article and the thumbnail in the teaser (with the image linking to the article) and publish.

That sounds like a lot of steps but it gets me what I want and I can do the picture manipulation in about a minute. I'm sure there are more clever ways to do it.

I do want CityDesk to help me manage pictures a little better but it will be a while before they can cram PhotoShop in there.

tk
Monday, September 15, 2003

Thanks, tk and Pat, for your suggestions.

I combined your ideas by working in the Article tab to edit the teaser text and insert the thumbnail photo. The Article tab has both a normal and HTML view, so its easier to adjust the thumbnail there. Then, working in normal view, I cut the teaser with thumbnail and pasted them into the teaser field of the extras tab. That worked.

Now the question became, how can I select the three most recent articles with teasers? (Not every article is worthy.)

Unfortunately, the blank/nonblank conditions apply only to if blocks. None of the looping constructs examine the teaser field. I resorted to the old keyword trick: I added "(featured)" to those articles I wanted to feature.

Here is the beginning of the for block:

{$ forEach 3 x in (and (folder "article/*")((keywordContains "(featured)") )) sortDescendBy .filedDate $}

Thanks again.

Joel Shprentz
Tuesday, September 16, 2003

*  Recent Topics

*  Fog Creek Home