Reputation: 935
Hi im using ckeditor so i currently have the html version which is
<textarea class="ckeditor" name="editor" id = "stuff">
{{ $opendoc }}
</textarea>
the $opendoc
came from my controller. it contains txt in my controller it looks like this
$fname = $file->filename;
$opendoc = file_get_contents(public_path('uploads/docs/' . $fname));
return View::make('dmy.open_doc' , compact('title', 'smpl' , 'opendoc'));
im trying to display the data using laravel 4.2 textarea currently im using something like this
{{ Form::textarea('open_file', $opendoc , array('class' => 'ckeditor')) }}
but the value of $opendoc
could not be viewed. any ideas what im doing wrong? thanks in advance
Upvotes: 1
Views: 640
Reputation: 1379
Use the Form::textarea() method.
The simplest usage is to only pass a single argument, the name.
{{ Form::textarea('notes') }}
This produces the following HTML.
<textarea name="notes" cols="50" rows="10"></textarea>
Notice the default cols and rows.
You can pass the value as the second argument.
{{ Form::textarea('notes', '3 < 4') }}
The value will be escaped.
<textarea name="notes" cols="50" rows="10">3 < 4</textarea>
Additional options can be passed as a third argument. This must be an array.
{{ Form::textarea('notes', null, ['class' => 'field']) }}
This will add the class "field" to the text area.
Your solution
{!! Form::textarea('open_file', isset($opendoc)? $opendoc:null, array('class' => 'ckeditor','size' => '10x3')) !!}
Upvotes: 0
Reputation: 521
It just shows the textarea but without any contents - check whether that variable is set or not.
{!! Form::textarea('open_file', isset($opendoc)? $opendoc:null, array('class' => 'ckeditor','size' => '10x3')) !!}
Upvotes: 1