small medium large xlarge

Generic-user-small
07 Jul 2008, 14:27
James West (104 posts)

Hi,

for the product listing on page 91 the actual product image replaces the file path text with the following

<%= image_tag product.image_url, :class => ‘list-image’ %>

I am playing around with CSS and have removed all the table references and am formatting the page using CSS only with a fluid relational structure.

The problem is that if there is no image to display, as I have not forced there to be an image in the model, the layout gets totally messed up so I am trying to use a condition to test if there is a value in the image_url before I actually place the image.

Any suggestions as to how to do this would be really appreciated.

Generic-user-small
07 Jul 2008, 23:57
James West (104 posts)

Hi, After a lot more digging around I found 2 things.

The display layout was getting messed up because I wasn’t using the right doc type so I have switched it to

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

and all is O.K. except that I still get the annoying little x in a box place holder for the image icon if the image url is not entered when viewed in i.e. 6 however the display is fine in firefox I have tried an unless nil block and an unless empty block but neither prevent the code from being called so please help. If someone could supply the syntax I would be really happy ;-) James
You must be logged in to comment