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.

eZ debug

Timing: Jan 19 2025 00:25:48
Script start
Timing: Jan 19 2025 00:25:48
Module start 'layout'
Timing: Jan 19 2025 00:25:48
Module start 'content'
Timing: Jan 19 2025 00:25:49
Module end 'content'
Timing: Jan 19 2025 00:25:49
Script end

Main resources:

Total runtime0.8289 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 588.9219152.6094
Module start 'layout' 0.00740.0033 741.531339.4297
Module start 'content' 0.01060.8163 780.9609529.8984
Module end 'content' 0.82700.0016 1,310.859412.3438
Script end 0.8286  1,323.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4638160.0002
Check MTime0.00140.1683160.0001
Mysql Total
Database connection0.00200.247210.0020
Mysqli_queries0.771093.0135570.0135
Looping result0.00070.0832550.0000
Template Total0.789595.220.3948
Template load0.00270.322120.0013
Template processing0.786894.918820.3934
Template load and register function0.00120.139910.0012
states
state_id_array0.00100.118910.0010
state_identifier_array0.00170.207320.0009
Override
Cache load0.00220.2660120.0002
Sytem overhead
Fetch class attribute can translate value0.00330.393420.0016
Fetch class attribute name0.00200.235740.0005
XML
Image XML parsing0.00120.148520.0006
class_abstraction
Instantiating content class attribute0.00000.001640.0000
General
dbfile0.00120.1467150.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs