Jump to content

new line in prestashop l(anguage) function


MrGumby
 Share

Recommended Posts

Hello,

 

I have infobox in my form, which contains quite a lot of text. I want to format that text into paragraphs so basically I need to put two newlines `\n\n` between each paragraph.

 

What is proper way of doing this, while use prestashop `l()` function? I think about two ways, but each one has its drawback.

 

1/ create each paragraph as single `l()` function and then insert these functions with `<br /><br />` tag between them. This way, the text is cutted into several chunks and this could make translation more difficult .

 

2/ write (somehow) newline into prestashop `l()` function, but write `\n`, into double quoted string, do not do any newline, and I can hardly think any better solution, so this is tricky. Also, is there any limit for length of string passed to `l()` function?

Share this post


Link to post
Share on other sites

  • 7 years later...

Hello, a bit late for you I think, but since I was searching for this problem and it was first on google, I will post my solution here:

{l s="Some text here %nl and a new line here" sprintf=["%nl" => "<br>"]}

simply set up a variable that will include the breakspace wherever you want like in this example

And no, there's no limit to language function beside of the one setup in database, which should be 255bytes (it's a tones of characters)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More