Question

I have been searching for a possible cause of this issue but I couldn't find it.

I already saw this topic here but it didn't help me.

I am building a very simple CMS using exactly this technology, plus CKeditor. Everything works just fine until I decide to add some styling on my RTE, like for instance, Bold text. When I press the Submit button, the rendered html has the [b] tags.

After some investigation I went to CKeditor's config file and wrote this: config.htmlEncodeOutput = false, which didn't help either.

What might the problem might be? To not leave any questions about my code, I leave you the code below:

A PHP file with all the editable fields that the back end picks up:

$text13 = "innehall/text13.txt";
if (isset($_POST['body13'])) {
    $newData = nl2br(htmlspecialchars ($_POST['body13']));
    $handle = fopen($text13, "w");
    fwrite($handle, $newData);
    fclose($handle);
}
if (file_exists($text13)) {

    $myData13 = file_get_contents($text13);
    $myData13 = $myData13;
}

The back end file:

<form id="form" name="form" method="post">
        <label>Beskrivning:</label>
        <textarea class="ckeditor" name="body13" id="body13">
        <?php echo str_replace("<br />","",$myData13); ?>
        </textarea><br>
        <input id="submit" name="myBtn" type="submit" value="Uppdatera fältet" />
</form>

A php file with all the sources that the index will pick up:

$text13 = "administration/innehall/text13.txt";
if (file_exists($text13)) {

    $myData13 = file_get_contents($text13);
}

The index.php

<div class="six columns">
      <p><?php echo $myData13 ?></p>
</div>

Pas de solution correcte

Autres conseils

Can you post the contents of the text file you are saving to - I think you will find that the tags are being escaped but want to check that first.

If the tags are being escaped when you save then you need to unescape them when you show the output not just echo.

Also I guess $myData15 is meant to be $myData13???

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top