Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Show first X articles with nonblank Y field?

I'm thinking this is impossible?  Think I'll have to PHP it.

On my site, some articles have a sidebar image.  What I'd like is to create a loop which inserts the three most recent sidebar images and then stops.

Currently, I just have a loop which inserts any nonblank sidebar data from the five most recent articles. See here where two of the five most recent articles (songs) have sidebar images.  This could just as easily be five images or none.

Mark Major
Saturday, May 31, 2003

The only thing I can think of would be to add a keyword manually to any articles with an image, then it would be easy.

Joel Spolsky
Thursday, June 5, 2003

It is my impression from this forum that keywords are somewhat underestimated. I personally find that they often represent an easy and quick solution to many problems that otherwise would call for external use of PHP or the like. They might not be so "brainy" from at programmers point of view but they are certainly effective and can save you a lot of time.

Jorgen Brenting
Thursday, June 5, 2003

Thanks, I guess keywords are quite a good answer.

I wrote a macro to grab winamp id3 data and insert it into CityDesk.  It's no problem for the macro to also insert [sidebar] each time (glad I don't have to do it by hand though.)

Mark Major
Thursday, June 5, 2003

If you don't need exact numbers you can do a loop that brings in a bunch of articles and then does an ifnonblank on them.

So a loop with 20 articles may bring in 3 or 7 or 15 or something.
Thursday, June 5, 2003

Thanks.  That's where I'm at currently.  Just a bit too unpredictable though.


(P.S. You may see your old band Pettycoat listed in the top 5 mp3s on the sidebar of the music page!  I'll have to pick a song, add a short clip and link to my music recommendations pages.)

(P.P.S. Everyone else should go check out MarkTAW's old band if you are into indie music.)

Mark Major
Friday, June 6, 2003

Wow thanks. Yeah we were doing some pretty cool stuff.
Friday, June 6, 2003

I used to have a "what I'm listening to now" part on my website, along with movies I'd seen recently and books I was reading, but it became too annoying to keep up so I got rid of it.
Friday, June 6, 2003

*  Recent Topics

*  Fog Creek Home