I am facing a rendering problem... in my product.blade.php I would like to show in a part of the page the html content from an external source without iframe. I want to make a call like :
{!! View::make('pages.viewer', ['docUrl' => url('get-DocHtml/' . $primaryAttachment->id)]) !!}
In my route :
Route::get('get-DocHtml/{id}', 'PagesController@getDocHtml');
In PagesController.php :
public function getDocHtml($id){
$attachment = Attachment::find($id);
$filepath = Storage::disk('S3')->url($attachment->filename.'/test.html');
return \Response::make(file_get_contents($filePath), 200, [ 'Content-Type' => 'text/html; charset=utf-8' ]);
}
I don't know how to make it render in viewer.blade.php or directly in my product.blade.php like a all to the function and render it directly...
Is someone has any idea how to render it (without helpers) ?
Thanks for your help.
Why don't you pass
file_get_contents($filePath)
as variable to view?
your method getDocHtml
should return view in that way:
return view('viewer')->with([
'external' => file_get_contents($filePath)
]);
Then you can do anything with passed $external
variable
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.