简体   繁体   中英

Write link and New lines in a textarea with Laravel 5

I need to send an Invite mail. Text will be:

Hi mate,

Join our tournament clicking this link: http://link.to.registration.with.token

First, I manage internationalization, so I get it like that:

'invite_template' => 'Hi Mate, \r\n Click the link :link ',


$message = trans('crud.invite_template', ['link' => '<a href="http://link.with.token">link</a>' ]);

And then :

  {!!  Form::textarea('message',nl2br(e($message)), ['class' => 'form-control']) !!}

But this is my problem:

  1. I \\r\\n is changed to <BR /> , so Textarea looks bad
  2. Link is displayed in HTML too, not interpreted too

Is it possible to do so???

You shall do this in 2 ways.

Method 1 : Print the text content in Text Editor

Step 1 : Include ckeditor.js

<script src="{{ asset('/').('public/lib/ckeditor/ckeditor.js') }}"></script>  

And then

Step 2 : Write your text

<textarea class="ckeditor">{{ $yourTextContent }}</textarea>

Method 2 : Echo'ing the input

Just do

echo $yourContent;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM