1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linebreaks with Custom Fields?

Discussion in 'XenForo Questions and Support' started by nrep, Dec 1, 2011.

  1. nrep

    nrep Well-Known Member

    I've got a custom field that is a multi-line textbox, but when I try and use this information in a template by calling {$user.customFields.fieldname} it shows without the linebreaks.

    Is there a way to include the linebreaks? The template for the info tab on the profile page seems to include some sort of HTML version of the customfields - but I can't figure out how to do this.
     
  2. high1976

    high1976 Active Member

    encountered the same issue today, did you find any solution yet?
     
  3. nrep

    nrep Well-Known Member

    Unfortunately not - although I did have partial success by wrapping the field contents in a [pre] tag :)
     
    high1976 likes this.
  4. Robbo

    Robbo Well-Known Member

    {xen:raw $user.customFields.fieldname}
     
  5. high1976

    high1976 Active Member

    nope, that doesn't work for multi-lines. It shows the fieldcontent ofc but it strips linebreaks aso so it's not really usable.

    .fieldValueHtml might help (template: custom_field_view )but I wasn't able to get it working yet...
     
  6. Robbo

    Robbo Well-Known Member

    Try {xen:string nl2br, $user.customFields.fieldname} and use new lines instead of <br />.

    Checking if that is correct now, will edit in a sec if not.
     
    nrep, Jake Bunce and high1976 like this.
  7. high1976

    high1976 Active Member

    ah, works perfectly with default multi-lines, many thanks Robbo!
     
  8. nrep

    nrep Well-Known Member

    Works perfectly - thankyou!
     

Share This Page