Forums / Setup & design / Unwanted br tags, where do they come from?

Unwanted br tags, where do they come from?

Author Message

Mark Irvine

Thursday 01 April 2004 9:23:46 am

Hi,

I've created a class with an attribute 'wanted_offered' which is a select list where user selects wanted or offered. When I try to show what was selected in a template with:

{attribute_view_gui attribute=$node.object.data_map.wanted_offered}

I get:
Wanted<br/>

My question is, where does the br tag come from? And how can I stop ezpublish from outputting this br tag?

Thanks,
Mark

Bruce Morrison

Thursday 01 April 2004 3:05:22 pm

Hi Mark

The template design/standard/templates/class/datatype/view/ezselection.tpl generates the output for the selection datatype.

You can copy this file to design/"your design"/templates/class/datatype/view/ezselection.tpl and make any adjustments to it.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Frey Staso

Monday 14 March 2005 9:27:57 am

This thread is a little old, but I figure better to bring it back than make a new thread on the same problem. I understand that I need to override this template, however I am unable to discern WHAT needs to be changed, nothing jumps out at me. Here is the override code in the default file:

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
<div class="block">
<label>{'Type'|i18n( 'design/standard/class/datatype' )}:</label>
    {section show=$class_attribute.data_int1}
        <p>{'Multiple choice'|i18n( 'design/standard/class/datatype' )}</p>
    {section-else}
        <p>{'Single choice'|i18n( 'design/standard/class/datatype' )}</p>
    {/section}
</div>

<div class="block">
<label>{'Options'|i18n( 'design/standard/class/datatype' )}:</label>
{section show=$class_attribute.content.options}
<table class="list" cellspacing="0">
{section var=Options loop=$class_attribute.content.options sequence=array( bglight, bgdark )}
<tr class="{$Options.sequence}"><td>{$Options.item.name|wash( xhtml )}</td></tr>
{/section}
</table>
{section-else}
<p>{'There are no options.'|i18n( 'design/standard/class/datatype' )}</p>
{/section}
</div>

Thanks!

Arran Price

Tuesday 15 March 2005 2:14:28 pm

Are you sure you have the right template?
Heres the code we used in our copy/override ezselection.tpl
It should only have the <br/> removal being different from the standard one.

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{* This version has <br/> tag removed - Arran Price Cerebrate Ltd 3 Feb *}
<div class="block">
 {section show=$class_attribute.data_int1}{"Multiple choice"|i18n("design/standard/class/datatype")}{section-else}{"Single choice"|i18n("design/standard/class/datatype")}{/section}
</div>

{section name=Option loop=$class_attribute.content.options}
  {$Option:item.name|wash(xhtml)}
{/section}

Frey Staso

Tuesday 15 March 2005 2:51:25 pm

I must be trying to override the complete wrong thing because no matter what I do to /class/datatype/view/ezselection.tpl in plain_user it doesn't change a thing...plus it is weird that the standard code I started with was so different from yours...

let me try a few things in this line of thought and the code you posted. Thanks a lot btw, this ezpublish thing was sort of dumped in my lap and its tricksy to say the least.

edit: ok baby steps
design/standard/templates/class/datatype/view/ezselection.tpl was the code I posted above. Putting an override on this file of the code does nothing. If I delete the code it doesn't change. This leads me to believe that I am editing the wrong file, even though I have checked the path name several times. Which file should I be overriding?

edit again: whoo! ok here was my problem, as expected I WAS overriding the wrong thing. I SHOULD have been overriding /content/datatype/view/ezselection.tpl

thanks again arran

Arran Price

Tuesday 15 March 2005 4:08:34 pm

Try putting your code (or what I posted) in
design/intranet/templates/content/datatype/view/ezselection.tpl
(replace intranet with your sitename as appropriate).
You shouldnt need an override for this.
See if that works for you. (maybe put some rubbish text in the top of the new template just so you can easily tell its working).

Let me know if that works for you.

Arran

Frey Staso

Tuesday 15 March 2005 4:32:10 pm

Works like a charm. I was trying to use the selection datatype so the user could select which picture he wanted from the drop down list and then dynamically use the selection as the file name. Obviously having <br/> in it wasn't going to go through.

Anyway just one small victory, thousands more to go ;)