Forums / Developer / using braces

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