passing variable with texteditor tinymce

Talk about any other operations you need to implement: additions, updates etc.

Moderator: alexandrleonenko

paragate
Master
Master
Posts: 151
Joined: Nov 13th, '14, 13:04
Location: Denmark, Odense

passing variable with texteditor tinymce

Postby paragate » May 3rd, '17, 10:45

Hi,

seems that input field textarea and tinymce editor escapes php-coding while javascripts is allowed like

Code: Select all

<h4 class="card-title">test 4</h4>
                        <p id="demo"></p>

<script>
var x = 5;
var y = 6;
var z = x + y ;
document.getElementById("demo").innerHTML = z;
</script>
<p> some more html </p>


Do Anyone knows how to do the same with php variables?
Or passing file.tpl
Regards

ne_moj
Master
Master
Posts: 243
Joined: Jan 1st, '16, 14:11

Re: passing variable with texteditor tinymce

Postby ne_moj » May 4th, '17, 13:41

Hello Henrik
---
I already answered you, but I want that the person who faces this problem know what he needs to do.
---
The problem is that the php code is executed on the server side, and what you are describing is not a php file, it is a string that is in the database, and in order for it to be executed you need to pass it through the eval function (see http://php.net/manual/en/function.eval.php) and it's very dangerous, I think it's not worth doing. Perhaps there is another way to solve this problem?


Return to “Additional operations implementation”