samedi 24 juin 2017

CKeditor with laravel/database

I am building a simple blog but I would like to use the CKeditor for the blog message so users can style the blog message a little bit. I have never used CKeditor before and I am a bit new to Laravel also. So I managed to turn my textarea in a CKeditor field and I also build a function to store the blog posts. Thats not a problem, I see data in my database and also at my blog overview page.

But, CKeditor/Laravel will obviously store the tags, that are generated by CKeditor, in the database and will display them as just text. How can I display the text just like code?

Blog message now:

enter image description here

CKeditor

enter image description here

My code

Form

       <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label for="bericht">Nieuwsbericht <span class="required">*</span></label>
                            <textarea class="form-control" id="bericht" name="bericht" required></textarea>
                        </div>
                    </div>
                </div>

                <script type="text/javascript">
                    CKEDITOR.replace( 'bericht' );
                </script>

Display a blog post

<div class="blog-post">
                        <div class="row">
                            <div class="col-md-12">
                                <h1></h1>
                            </div>

                            <div class="col-md-12">
                                <h3></h3>
                            </div>

                            <div class="col-md-12">
                                <p class="date">, Door </p>
                            </div>

                            <div class="col-md-12">
                                <p class="blog-message">

                                    

                                </p>
                            </div>
                        </div>

                    </div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire