AyeTry
AyeTry

Reputation: 75

Getting tinymce to display what I type withing the textarea?

At the moment I am able to post content to the database and retrieve this content via SQL querys.

Unfortunately, When I do retrieve the content it appears as so on the webpage

<p>Shaun this is the record</p> <p>The next line of the r...

I understand that this is most probably to do with the config and I have tried several solutions but all have failed.

Could someone instruct me as to what I should have in my config?

Here is what my current config looks like, it is simply placed within the tags of the php file:

<head>
<script language="javascript" type="text/javascript" src="/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({        
            theme : "advanced",       
            mode : "textareas",
            encoding : "xml"});
</script>
</head>

Thanks for your time, any solution would be fantastic!

$sql = "SELECT * ".
   "FROM podContent ORDER BY id DESC ".
   "LIMIT $offset, $rec_limit ";

$podText = htmlspecialchars_decode($row['imageName']);

$retval = mysql_query( $sql, $con );
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "<div class=\"pods\">";
echo "<a href=\"/page.php?id={$row['id']}\">";
echo "<div class=\"podHeading\">";  
echo "{$row['heading']}</a> <br> ";
echo "</div>";
echo "<div class=\"podImage\">";    
echo "<img src=\"images/{$row['imageName']}\">";
echo "</div>";

$string = $podText;
if(strlen($string) > 100) {
echo substr($string, 0, 100).'...'.$hyperlink;}
else {
echo $string;

}

You should be looking for the $podText variable and the $string variable.

Upvotes: 1

Views: 288

Answers (1)

Ajeet  Sinha
Ajeet Sinha

Reputation: 2345

You can use the a php function to decode these characters back like

$variable_to_display = htmlspecialchars_decode($variable_from_database);

try this

$sql = "SELECT * ".
   "FROM podContent ORDER BY id DESC ".
   "LIMIT $offset, $rec_limit ";



$retval = mysql_query( $sql, $con );
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{

echo "<div class=\"pods\">";
echo "<a href=\"/page.php?id={$row['id']}\">";
echo "<div class=\"podHeading\">";  
echo "{$row['heading']}</a> <br> ";
echo "</div>";
echo "<div class=\"podImage\">";    
echo "<img src=\"images/{$row['imageName']}\">";
echo "</div>";

$podText = htmlspecialchars_decode($row['imageName']);

$string = $podText;
if(strlen($string) > 100) {
echo substr($string, 0, 100).'...'.$hyperlink;}
else {
echo $string;

Upvotes: 1

Related Questions