ck editor content does not displaying as html in frontend - laravel

My website is in Laravel. I am makeing about-us page in ckeditor on the Admin side.On the admin end, it works fine. I save the content json_encoded in DB. Issue is that when i want to display it on the front end side it displays the content as string . Have a look at result
what i am doing in blade.php is here

Your current output is escaped(safe-printed) by default, try printing the content by using:
#if (isset($about?->about))
{!! json_decode($about->about) !!}
#endif
Read more: Laravel Docs: Displaying Unescaped Data

Related

Pass image in yield section in laravel

For the <title> I've followed this SO answer This is working perfectly for part but the image is not working
Laravel dynamic page title in navbar-brand
But, Here when I try to make an image dynamic instead of title it's giving me a text instead of an image.
For instance,
header.blade.php
#yield('image')
In another blade, I called image as in section
#section('image', '<img src="http://localhost/appname/public/front/images/heading.png">')
Every page has a dynamic logo so I want to put logo dynamic the same like we're doing in the title.
But the result I'm getting is
<img src="http://localhost/appname/public/front/images/heading.png">
You can do like this
#section('image')
<img src="http://localhost/appname/public/front/images/heading.png">
#endsection

In voyager admin panel how to solve directory separator issue

I have created a page in the voyager admin panel, but when I tried to retrieve in view the path of the image is like
http://localhost:8000/storage/pages\October2019\eltiRUSN1BArKdXi4uyl.png
you noticed that the first forward slash and then next backward slash, so that's why an image is not displaying in view.
I used this code to print an image.
<div class="header_bg" style="background-image: url('{{ url("storage/$page_data->image") }}');"></div>
Instead of creating a url with url(), maybe you could use Laravel File Storage helpers, like Storage::get('file.jpg');. I believe these work in blade, so in your case, it would be:
<div class="header_bg" style="background-image: url('{{ Storage::get($page_data->image) }}');"></div>
The answer is, this image is set by voyage admin so I have use voyager language.
<div class="header_bg" style="background-image: url('{{Voyager::image($page_data->image)}}');"></div>
to the print image which set from voyager in blade view use this syntax
{{Voyager::image($page_data->image)}}

ckeditor textarea output as html tags in browser. I am using laravel 5.2 and mysql database. How to fix this issue?

I want to get the textarea data and show in browser. I am using CKEditor with textarea. But textarea data show with html tags as output.
In the editor I write "This is textarea" but it displays as <p>This is text textarea</p> in browser.
Trying to set up configuration of ckeditor config.js file from the documentation with 'config.htmlEncodeOutput = true' and 'config.basicEntities = false'. But it doesn't work.
<textarea name="post_description" id="editor" cols="30" rows="15" class="form-control"></textarea>
You need to properly escape strings that contain HTML tags so that they are formatted by browser engine. In Laravel you can simply change where you display your content from:
{{ $text }}
to
{!! $text !!}

CKEDITOR extra html tag when paste from word

I have blog page in my website and website try to write content with CKEDITOR and copy it from word but when the content publiched, the html have too many extra tag that the are not useful.
how can we filter and delete extra tag and just save main html tag for blog page
thank you
As you did not provide any code sample, its hard to find out your problem. From my understanding I am writing this answer. Hope this will help.
When you save the text from the CKEDITOR fields, it saves text and HTML tags as well. So while viewing the saved texts, you can use the Laravel blade engine print function like this.
{!! $variale->field_name !!}
It will remove the HTML tags and only the text will be shown.

fonts not working when str_limit helper is used in laravel 5.4

I have a notice page where it shows the title and brief description of the notice through str_limit helper function. and notice_show page shows the full description. I posted a notice using Kantipur font (used for Nepali typing) in tinymce editor.
The notice_show page shows the description as it is expected to show but the notice page shows some annoying characters like hgHof]lt ax'd'vL SofDk;sf] egf{ ;DalGw ;"rgf &nbsp...
notice_show page directly pulls the description from the database by
{{$notice ->description }}
notice page truncates description by
{{ (str_limit(strip_tags($notice->description), 100)) }}
Images of notice and notice_show pages are upload below:
you have to use this :
{!! (str_limit(strip_tags($notice->description), 100)) !!}

Resources