ezimage() in CSS?

Author Message

Aaron Carlino

Tuesday 27 February 2007 11:30:28 am

I love the ezurl(), ezdesign(), and ezimage() functions for templates, but what do you do in your CSS file when you need to reference an image? I had use an absolute path to get it to work.

Mark Marsiglio

Tuesday 27 February 2007 11:52:56 am

You can't put them in an external CSS file, but you could do it with inline styles, or some properties set in the page head. Have the majority of your styles externally, and a few images called from within the page template.

Typically, template images (CSS backgrounds) are stored not in the CMS, but in the images folder in your design. Then, in the css file, reference the image with url(../images/imagename.png). This prevents the CMS from controlling those images, but most don't usually need to be.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Aaron Carlino

Tuesday 27 February 2007 12:11:57 pm

Okay, thanks.. I'm pretty sure I tried that, but I'll give it a go again. We use a lot of CSS defined background images here, especially with CSS sprites, menus, and image replacement, so it would be nice it we could find a way to implement that easily.

It's really hard to tell with eZpublish what is a real folder and what is virtual. I assumed that since I had called the stylesheet using ezdesign() the paths in the stylesheet could be relative.

/stylesheets/style.css could refer to: ../images/image.gif

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.