Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-14 16:18:22

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

How do I convert line breaks on File Description?

Hey!
I will like use the file description field as my “body” and I need to convert the line breaks

In the past Ruud gived me a code for linebreaks for custom fields:

<txp:php>
  echo nl2br(trim(custom_field(array('name' => 'your_custom_field_name'))));
</txp:php>

How do I change it to be for the file_download_description please?

Offline

#2 2009-10-14 16:21:15

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I convert line breaks on File Description?

You can also use upm_textile :)

Offline

#3 2009-10-14 16:37:08

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: How do I convert line breaks on File Description?

Thanks that is cool!
can I make it to only convert linebreaks and not use any other Textile’s features please?

Offline

#4 2009-10-14 17:09:22

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How do I convert line breaks on File Description?

THE BLUE DRAGON wrote:

How do I change it to be for the file_download_description please?

<txp:php>
  echo nl2br(trim(file_download_description(array())));
</txp:php>

If you don’t want the description to be HTML-escaped:

<txp:php>
  echo nl2br(trim(file_download_description(array('escape'=>0))));
</txp:php>

Code is topiary

Offline

#5 2009-10-14 17:42:19

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: How do I convert line breaks on File Description?

Thanks Jeff! =)

Offline

Board footer

Powered by FluxBB