Jump to content
Larry Ullman's Book Forums

Recommended Posts

Here is a section of php code that I am using to read an html file and bring it into tinyMCE (html editor):   

 

$handle = fopen('textFiles/'.$category.'.html', "r") or die("Couldn't open this file.");
$_POST['editText']= fread($handle, filesize('textFiles/'.$category.'.html')) or die("Couldn't read from this file.");

 

 

 

 

Here is a section of the html file being read :

 

<a class="accordion-toggle" style="margin-left: 50%;" href="#collapseOne" data-toggle="collapse" data-parent="#accordion1">MORE INFO </a></div>

 

 

 

Here is what actually gets read into tinyMCE:

 

<a class="accordion-toggle" style="margin-left: 50%;" href="#collapseOne">MORE INFO </a></div>

 

 

--------------------------------------------

 

 

You see that a piece of html code gets eliminated from what is in the original html file:

data-toggle="collapse" data-parent="#accordion1"

 

 

 

PLEASE NOTE that tinymce editor gets the correct html code on my local server but gets the truncated version when done on the remote server. The php and html files are the same on both servers AND the version of tinyMCE is the same. Also, I have been using tinyMCE for years and never experienced this before.

 

ALSO, it is only that small piece of the entire html code that is left out!

 

Any thoughts?

Link to comment
Share on other sites

I tried running the following script on both my local XAMPP Apache server and my remote server provided by my hosting company, and I got the exact same output shown below on both.

 

Script:



<?php
  
  $data = file_get_contents('html.html');
  
  echo htmlspecialchars($data);


 

html.html file:



<a class="accordion-toggle" style="margin-left: 50%;" href="#collapseOne" data-toggle="collapse" data-parent="#accordion1">MORE INFO </a></div>


 

Output:



<a class="accordion-toggle" style="margin-left: 50%;" href="#collapseOne" data-toggle="collapse" data-parent="#accordion1">MORE INFO </a></div>


 

My recommendation is try to echo the HTML loaded from the file before you output it to TinyMCE. Then you can probably at least ascertain whether it's your server or TinyMCE that's the problem.

Good luck.

Link to comment
Share on other sites

 Share

×
×
  • Create New...