New line character problem.

Author Message

Dmytro Tomilovskiy

Wednesday 17 May 2006 6:59:11 am

Hi everyone.
I have a problem with this line of code:

var comicname ="{attribute_view_gui attribute=$node.object.data_map.label)";

For some reason it returns the following:

var comicname="\nBetween_Friends";

as apposed to:

var comicname="Between_Friends";

Any ideas why?

Thank you for your time.

Łukasz Serwatka

Wednesday 17 May 2006 10:53:04 am

Dmytro, hello and welcome to the eZ publish Community!

What datatype is label in your example?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Dmytro Tomilovskiy

Thursday 18 May 2006 8:00:12 am

Good day Lukasz.
In my example label is a Text Line, if that is what you mean.

I figured that this problem can be solved by editing

design/standard/templates/content/datatype/view/ezstring.tpl

Where I changed

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{$attribute.data_text|wash( xhtml )}

to

{* DO NOT EDIT THIS FILE! Use an override template instead. *}{$attribute.data_text|wash( xhtml )}

Does this look like a good solution to you?

Thank you for your time.

Łukasz Serwatka

Thursday 18 May 2006 11:39:53 am

It is not recommend to edit default eZ publish templates. Use override system instead.
Copy the original dir structure and file to your design directory:

(yourdesign)/standard/templates/content/datatype/view/ezstring.tpl

Then you can safely edit tpl file. Function attribute_view_gui uses template for rendering output from attribute.

In case where you need it in one place better use direct access to the attribute content:

This will return value from attribute (without new line, no tpl changes required)

{$node.object.data_map.label.data_text|wash()}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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