Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Displayin Associated Images for Articles?

I want to generate an index of book reviews on my page. Rather than just linking with the headline tag I'd like to display the book cover AND the headline (the title for example).

Is this possible and how would I do  this.

thanks.

Patrick Ansari
Wednesday, August 21, 2002

I suppose I could use extra1 and extra2 for this and manually paste HTML code in the text boxes provided but I find this a little bit messy to be honest. What happens when I delete the images and the HTML code in extra1 still points to them. This can become really messy as the site grows.

Patrick Ansari
Wednesday, August 21, 2002

ok this approach doesnt work either because the HTML source is converted to HTML &xxx; values. (< etc)

Patrick Ansari
Wednesday, August 21, 2002

You can put the image in an extra field or in the teaser with the teaser text.

In this page some of the teasers include images (I linked the image to the article).
http://members.tripod.com/mackenziegregory/log/

In this page the image is in the sidebar
http://tk-jk.net/Bridgers/index.html

Here is the CityScript: The article title is "Extra2," the teaser is in "Extra1," and the picture is in "Sidebar."  It goes into a 2-column table.

<table border="0" width="90%">
<tr>
<td>{$ foreach x in (or(folder "Mainpages")(folder "Workfolder"))&nbsp;$}
<tr>
<td valign="top" align="left"><b><A href="{$x.link$}">{$x.Extra2$}</A></b>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>{$x.Extra1$}</p>
</blockquote>
</td>
<td width="150" valign="center" align="left">{$x.Sidebar$}</td>
</tr>
<tr>
<td>{$next$}</td>
</tr>
</table>

tk
Wednesday, August 21, 2002

Ah nice one thanks. I guess I'm still thinking in more complex terms as is required for City Desk's simplicity. It's almost too simple for my taste ;p

Patrick Ansari
Wednesday, August 21, 2002

I've got two solutions that might help you.

For my book reviews and recommendations, I use a "content fragment" that I can include using a variable. The technique is explained here (and you can see one of the lists of books on the right hand side of the page):
http://www.pool-room.com/CodeCraft/CityDesk/ContentFragments.html

This technique involves maintaining a separate article that contains all the book images and links, so you need to update that article whenever you add or remove a review. But, it's included everywhere via a variable, so once you update the article it gets updated everywhere.

The other technique is to put the book image in the Extra1 field of your review article, as you hinted at. I do something similar for my photography page:
http://www.pool-room.com/Photo/PhotoCompetitions.html

Each thumbnail image is picked up from the Extra1 field of the corresponding photo's article, and the list is built using CityScript. It's a minor hassle adding all the thumbnails to the Extra1 fields (you can use the "Add Image" toolbar button to do it), but you don't have to update your index page when you add or remove articles. Alternatively, you could just copy and paste the corresponding thumbnail's Magic Name into the Extra1 field, and then have your CityScript loop add the necessary HTML around it to turn it into a link.

Hope this helps!

Darren Collins
Wednesday, August 21, 2002

Yep, thanks. I have added the picture to the extra1 field for now and I enclosed it with a link with {$n.link$}.

Seems fair enough for the time being.

Patrick Ansari
Wednesday, August 21, 2002

I have a different workaround. See http://www.aas.nl/diensten/product/swarc/boeken/index.html (dutch only)

each book = article
body = picture + optional link to ...
headline=title
author=authors
teaser=discription
extra1=publisher
extra2=isbn
keywords= keywords....  (you can use this in combination with keyword_contains)

each book is assigned my 'empty' template (and is therefore published as an empty file).  I find the body a better place for storing images. Separating all fields makes it more flexible for scripts.

Adriaan van den Brand
Friday, August 23, 2002

*  Recent Topics

*  Fog Creek Home