using braces

Author Message

David Jones

Thursday 31 August 2006 2:50:44 am

I want to overide a style sheet from within a template. but the braces that you need to use are causeing a problem.

To override a style I need to do something like;

<style type="text/css" media="screen">
body.sid1 #navigationContainer {
						
{let related_objects=fetch( 'content', 'related_objects', hash( 'object_id', $module_result.content_info.object_id ) )}

	{section loop=$related_objects var=related_object}
		{if eq($related_object.content_class.identifier, "image_header" )}
			background-image: url({"images/$related_object.data_map.image.content|wash"|ezdesign}) !important;
		{/if}
	{/section}
	}
</style>

But the braces needed for the style declaration are clearly being picked up by ezp.

Does anybody know a wat around this?

David Jones

Thursday 31 August 2006 4:12:17 am

I've fixed this issue now.

The problem I have now is that I can't display the image.

The code below displays the title field of my image_header class

$related_object.data_map.title.content|wash

but

This code does not display the image

$related_object.data_map.image.content|wash

image is the identifiyer of the image field so I expected this to output the path to the image.

It doesn't output anything.

Any ideas?

Thanks

Kristof Coomans

Thursday 31 August 2006 6:06:54 am

The content attribute of an image returns an eZImageAliasHandler object ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezimagealiashandler ).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Rob Borley

Thursday 31 August 2006 6:12:10 am

David, I think you want to end up with something like this:

{let related_objects=fetch( 'content', 'related_objects',
				  		hash( 'object_id', $module_result.content_info.object_id ) )}

	{section loop=$related_objects var=related_object}
		{if eq($related_object.content_class.identifier, "image_header" )}
		<style type="text/css" media="screen">
					body.sid1 #navigationContainer {concat('{')}

			background-image: url({$related_object.data_map.image.content.original.full_path|ezroot}) !important;
				}
				</style>
		{/if}
	{/section}

David Jones

Thursday 31 August 2006 6:20:04 am

perfect, thanks

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 31 2025 06:15:57
Script start
Timing: Jan 31 2025 06:15:57
Module start 'layout'
Timing: Jan 31 2025 06:15:57
Module start 'content'
Timing: Jan 31 2025 06:15:57
Module end 'content'
Timing: Jan 31 2025 06:15:57
Script end

Main resources:

Total runtime0.0144 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.0048 588.0078151.1953
Module start 'layout' 0.00480.0024 739.203136.6016
Module start 'content' 0.00720.0054 775.804794.1406
Module end 'content' 0.01260.0018 869.945333.9922
Script end 0.0144  903.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002617.8361140.0002
Check MTime0.00128.5639140.0001
Mysql Total
Database connection0.00053.448710.0005
Mysqli_queries0.002416.320230.0008
Looping result0.00000.084410.0000
Template Total0.00128.610.0012
Template load0.00106.842910.0010
Template processing0.00031.749210.0003
Override
Cache load0.00074.802410.0007
General
dbfile0.00138.850280.0002
String conversion0.00000.056340.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