Forums / Setup & design / Using image object for inline background style

Using image object for inline background style

Author Message

Martin Sanders

Monday 11 February 2008 10:00:53 am

Hi, How do I go about using an Image attribute within an inline style background-image div?

I've tried using:

<div style="background-image: url({attribute_view_gui image_class=articlethumbnail attribute=$node.data_map.image})">

However this isn't working at it includes the presentation template.

Any help most welcomed.

Felix Laate

Monday 11 February 2008 2:07:48 pm

Hi Martin,

the attribute_view_gui function returns the presentation template of the implicated datatype.

What you need if you whant to refer to an image in CSS is the url of the image. It can be found this way:

{$node.data_map.image.content.IMAGE_VARIATION.full_path}

where IMAGE_VARIATION is "large", "medium", "articlethumbnail" or whatever you would need (assuming that it is defined in image.ini).

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Martin Sanders

Monday 11 February 2008 2:16:14 pm

many thanks :)