Laravel summernote in displaying - laravel

Guys I need your help,
In summer note I add text like this:
summernote
But this is what I get as a result:
Result
What I do to desplay the text is like below:
{{ str_limit(strip_tags($place->description), 150) }}

Blade provides default protection against html/css/js code injection so you should try to use {!!instead of {{. Moreover, the strip_tags function will remove all html tags, but summernote will save what you wrote as html, so it needs it to be displayed as html. I would try something like that :
{!! str_limit($place->description, 150) !!}
Let me know if it helped you :)

Related

ck editor content does not displaying as html in frontend

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

how to ignore iframe on blade Laravel

#Asking
Help me for my problem, when i built a website with Laravel
i am render my post with syntax like this :
<div>
<p>{!! $post->content !!}</p>
</div>
but i have problem, when i insert a i frame inside post, because the html has been removed with {!! !!}.
i have to try use {{ $post->content }}, but all content rendered with HTML
Any solution to this problem? ?
Thanks very much
With {!! you paste content "as is", in other words you become vulnerable to all types of issues like allowing <script> tags to be placed into your templates.
The {{ syntax will escape any HTML thus what you see is the actual html characters without actually parsing it (i.e. doing {{ '<b>bold</b>' }} will not result in a bold font but in the text <b>bold</b>).
Now with your problem: there are some cumbersome ways to filter out any html tags yourself and leave the <iframe>'s in there (something like {!! only_iframe($content) !!}), but it is quite difficult and will likely not result in a safe solution.
Your own answer which stated that you used {!!html_entity_decode($post->content)!!} simply means that your HTML was encoded to start with, which is not something I can deduct from your question. Note that you are now vulnerable to malicious code injection if you are not certain you can control the contents of $post->content.

Using ckeditor i have stored description but in view i got the data with <p> tag how can i solve it?

When I am storing something using ekeditor in my Laravel project, I got the data in view the data with a <p> tag. How can I store my data without a <p> tag
Result:
<p>good<\p>
Expected result:
good
use textarea instead of CKEditor if you don't want tags to be stored.
otherwise, you can try this.
if you use {{ $data->xyz }} , it will show texts with tags. So use {!! $data->xyz !!} , it won't show tags but will convert in html codes.

Form::password in Laravel Blade Templates

I was trying to create a password field in the form in Laravel Blade templates but the output doesn't let me enter anything and it's not showing any placeholder either. The code doesn't cause any error.
Form:
{{ Form::open(array('class'=> 'forming')) }}
{{ Form::text('username','Username',array('class' => 'insi')); }}<br>
{{ Form::password('password',array('placeholder'=>'Password','class' => 'insi')); }}
{{ Form::close() }}
and the output is like that. Any help?
Second Input form is for password.
We are not seeing your generated HTML, but usually those problems are related to your HTML. For instance, you are using a CSS class 'insi', which may not letting you see the password characters.
To do a test remove/disable your CSS files from your main HTML and it probably will work fine.

Laravel Blade Highlight Change Tags

I am going to use AngularJS along with Laravel, and I wanted to change Laravel tags to [[ ]] (which I think BTW is nicer since [ ] looks more like blade and is sharper :p )
Anyhow, I changed it with
Blade::setContentTags('[[', ']]'); // for variables and all things Blade
Blade::setEscapedContentTags('[[[', ']]]'); // for escaped data
How do I change the "Bracket Highlight" in Sublime now so that it still highlights my new tags??
Not directly answerting your question, but my solution to have Angular and Blade playing nice is very simple, I create a _partial every time I need some Angular and name this partial just '.php' and not '.blade.php', so if I have a form that uses Angular, I have:
{{ Form::open() }}
#include('_partials.posts.forms.create');
{{ Form::close() }}
In this case the included file would be views/_partials/posts/forms/create.php.
About Sublime, download Blade Syntax Highlighter, this file might give you a clue about how to change that for you:
https://github.com/Medalink/laravel-blade/blob/master/laravel-blade.tmLanguage

Resources