inline CSS declaration on template

Author Message

Adolfo Antón Bravo

Monday 17 May 2010 11:17:29 am

Hi all

I've been looking along forums and I have not found some similar posts but this: http://share.ez.no/forums/setup-design/css-backgrounds, which says you cannot do what I want to.

I'd like to use a background image for every section in my web and every background can be changed by administrator. So I've thought I could make an attribute for my ez class "section" to change by administrator the background image.

I've thought in something like this:

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

What do you think about it?

xsto.info, el acceso a la información
dominios.coop, el ISP de la economía solidaria

Håvard Bergersen

Monday 17 May 2010 12:17:39 pm

Sure.. Why not? :)

Carlos Revillo

Monday 17 May 2010 2:12:16 pm

i think it should be possible to do it like that. in fact we have some similar examples. you should take care about absolute or relative paths.

but probably a more elegant solution could be usign ezjscore.

André R.

Tuesday 18 May 2010 1:04:11 am

I don't see how ezjscore would help here, but I might be overlooking something.

One way is to create some section class like you say and somewhere in pagelayout fetch the one closest to current node in current path using something like 'parent_node_id', $node.path_array and sorting it by path.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Adolfo Antón Bravo

Wednesday 19 May 2010 5:20:16 am

Hi all

10700 and me got it:

<body id="XXX" style="background: url('/{$PATH.data_map.IMAGE_CLASS.content.original.url}') 0 0 repeat;">

Thanks a lot!

xsto.info, el acceso a la información
dominios.coop, el ISP de la economía solidaria

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 29 2025 23:52:04
Script start
Timing: Jan 29 2025 23:52:04
Module start 'layout'
Timing: Jan 29 2025 23:52:04
Module start 'content'
Timing: Jan 29 2025 23:52:04
Module end 'content'
Timing: Jan 29 2025 23:52:04
Script end

Main resources:

Total runtime0.0180 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.2344151.2109
Module start 'layout' 0.00470.0028 739.445336.6484
Module start 'content' 0.00750.0090 776.093894.0625
Module end 'content' 0.01650.0015 870.156333.9922
Script end 0.0179  904.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002312.7280140.0002
Check MTime0.00126.4722140.0001
Mysql Total
Database connection0.00095.016110.0009
Mysqli_queries0.002413.345230.0008
Looping result0.00000.078310.0000
Template Total0.00105.810.0010
Template load0.00094.766510.0009
Template processing0.00020.991510.0002
Override
Cache load0.00063.140510.0006
General
dbfile0.002413.389080.0003
String conversion0.00000.038540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs