Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

access to HTML/formatting images in extras?

I'm still making my real estate site using City Desk, and thanks to the help I've received here, I've got it looking exactly how I want...except for one little thing:

I'm using a for loop to display thumbnail images, which are contained in the extra2 field. The thumbnails link to the full listing.

Here's the part of the code that's generating the link:

<a href="{$x.link$}">{$x.extra2$}</a>

The code that's generated is:

<A href="listings/fog0000000014.htm"><IMG height=120 alt=666666 src="listingpix/666666.jpg" width=160 border=0>

All I want is to put a border around them, and I can't figure out how to tell CD to make the border=1, because there's no "HTML view" for the extras, and no formatting options for images when I insert them.

Any ideas or suggestions are appreciated.

Debra Weiss
Sunday, December 23, 2001

Style sheets to the rescue!

In your template, add a style for IMG's in the HEAD tag.

For a 4 pixel, black border around all IMGs, you would do this:

<HTML>
<head>
<style type="text/css">
<!--
img {  border: solid black 4px; }
-->
</style>

Joel Spolsky
Sunday, December 23, 2001

Throw another life preserver for viewing with Netscape.  I don't even know if Netscape does picture borders but it made me wonder if instead of coding this (and using a style sheet):

<a href="{$x.link$}">{$x.extra2$}</a>

You could just put the image's URL (or magic name) in the "extra2" field and use something like this:

<a href="{$x.link$}">IMG height=120 alt=666666 src="{$x.extra2$}" width=160 border=4></a>

Would that work?

TK
Sunday, December 23, 2001

yep, that would work too.

Joel Spolsky
Monday, December 24, 2001

Something that should work reasonably well with all browsers would be to put the image inside a table consisting of a single cell. Make the table background the color you want the frame to be, and make sure that there's cell padding of the size you want the frame to be. It's ugly, but it should be universal.

Steven C. Den Beste
Tuesday, December 25, 2001

TK: regarding your "inline" formatting suggestion above, it might be nice to put the html & script into a variable:


{$.IMGFormat$} would equal

IMG height=120 alt=666666 src="{$x.extra2$}" width=160 border=4>

Then, in the extra2 field, you could just cut and paste this:

< a href="{$x.link$}" {$.IMGFormat$} </a>

Ben

Ben Meiry
Wednesday, January 23, 2002

*  Recent Topics

*  Fog Creek Home