Forums / Setup & design / <P> tags, <BR>s and XML text fields

<P> tags, <BR>s and XML text fields

Author Message

Barney Gumble

Tuesday 27 January 2004 2:34:06 pm

In 3.3.2 I noticed that my xml text fields were being enclosed with <P> tags which would make my desired layout impossible, so under advice from another forum post I edited

design\standard\templates\content\datatype\view\ezxmltags\paragraph.tpl

and removed the <P></P> tags from around the content. However my line breaks in the xml text fields were then ignored, and new lines and paragraphs impossible.

All I want is to be able to display xml text fields without a gap above and below.

Any help will be greatly appreciated as always!

Alex Jones

Tuesday 27 January 2004 2:56:32 pm

What effect are you trying to achieve? You mention that you do not want the text wrapped in paragraph tags, does that mean you just want line break tags inserted?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Barney Gumble

Tuesday 27 January 2004 2:59:53 pm

Alex, all I want is to be able to display xml text fields without a gap above and below due to the embedded <P>. If I leave paragraph.tpl untouched, then my new paragraphs are fine, but the gap above and below the whole field comes back.

Alex Jones

Tuesday 27 January 2004 3:12:37 pm

Ahhh. Perhaps you could get around the issue with CSS, thus ensuring that your markup remains valid? Is the XMLTextfield within a container element? If not, could it be? If you were to wrap a div around that XML Text Field in your template and set the top and bottom margins to negative values like -0.6em you would be able to reduce or eliminate the gap you are speaking of.

Example:

<div style="margin: -0.6em 0;">{your ez code}</div>

Of course the style elements could be moved to a separate style sheet, but it get's the idea across.

Would that work?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Barney Gumble

Tuesday 27 January 2004 3:44:39 pm

Spot on, Alex. I turns out that the <P> is only critical in a small number of templates, so I've placed the field in a container as you suggested i.e. <DIV STYLE="margin: -1.7em 0 -1.7em 0;">. This starts the paragraph one line above it normally would have, and stops the gap at the end. Nice one thanks!

Alex Jones

Wednesday 28 January 2004 6:43:34 am

Happy to help! The flexibility and control provided by CSS is a wonderful thing.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Barney Gumble

Friday 30 January 2004 8:32:38 am

For anyone interested I eventually found another solution. I found that when xml textfields were placed in their own table cell, then the margins above and below did not occur. Sounds so simple really!