1 Replies - 249 Views - Last Post: 15 May 2013 - 11:11 AM Rate Topic: -----

#1 seyidesh  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 51
  • Joined: 24-November 10

WYSIWYG Display Error

Posted 15 May 2013 - 10:47 AM

Hello guys, Can anyone please explain to me why my WYSIWYG is displaying in this format:

<h2 style="margin: 0px; padding: 0px 0px 20px; border: 0px; outline: 0px; font-size: 36px; font-family: Helvetica, Arial; vertical-align: baseline; color: rgb(0, 0, 0); line-height: 1.1em; text-shadow: rgb(255, 255, 255) 0px 1px 0px; letter-spacing: -1px;"><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-weight: inherit; font-style: inherit; font-size: 30px; font-family: inherit; vertical-align: baseline; color: rgb(95, 95, 95);">Step 2</span>: Introduction to the Header/Footer System</h2><p style="margin: 0px; padding: 0px 0px 15px; border: 0px; outline: 0px; font-size: 14px; font-family: Arial, Helvetica, sans-serif; vertical-align: baseline; color: rgb(87, 87, 87); line-height: 21px;">Each page of our forum needs a few basic things, like a doctype and some markup. That�s why we�ll include a header.php file at the top of each page, and a footer.php at the bottom. The header.php contains a doctype, a link to the stylesheet and some important information about the forum, such as the title tag and metatags.</p><h5 style="margin: 0px; padding: 0px 0px 5px; border: 0px; outline: 0px; font-size: 14px; font-family: Helvetica, Arial; vertical-align: baseline; line-height: 1.1em; text-shadow: rgb(255, 255, 255) 0px 1px 0px;">header.php</h5>

instead of displaying in this format:

Step 2: Introduction to the Header/Footer System
Each page of our forum needs a few basic things, like a doctype and some markup. That’s why we’ll include a header.php file at the top of each page, and a footer.php at the bottom. The header.php contains a doctype, a link to the stylesheet and some important information about the forum, such as the title tag and metatags.

header.php



I want the users to be able to see what they posted exactly how thy have posted in WYSIWYG text editor in my post area.

in my topip_view.php i have this code to display the content in the database.

		
//first select the category based on $_GET['cat_id']
$sql = "SELECT
			*
		FROM
			topics
		WHERE
			 cat_id='".$cid."' AND topic_id='".$tid."' LIMIT 1";
			
$result = mysql_query($sql) or die (mysql_error());

if(!$result)
{
	echo 'The topic could not be displayed, please try again later.';
}
else
{
	if(mysql_num_rows($result) == 0)
	{
		echo 'This topic doesn&prime;t exist.';
	}
	else
	{
		while($row = mysql_fetch_assoc($result))
		{
			//display post data
			echo '<table  id="topic">
					<tr>
						<th colspan="2" id="post_title">' . $row['topic_title'] . '</th>
					</tr>';
		
			//fetch the posts from the database
			$sql2 = "SELECT
						posts.topic_id,
						posts.post_content,
						posts.post_date,
						posts.time,
						posts.post_creator,
						users.user_id,
						users.user_name
					FROM
						posts
					LEFT JOIN
						users
					ON
						posts.post_creator = users.user_id
					WHERE cat_id='".$cid."' AND topic_id='".$tid."'";
						
			$res2 = mysql_query($sql2) or die (mysql_error());
			


	
			
			while($row2 = mysql_fetch_assoc($res2)){
				$creator =$row2['user_name'];
				
				
$timeAgoObject = new convertToAgo; // Create an object for the time conversion functions
// Query your database here and get timestamp
$ts = $row2['time'];
$convertedTime = ($timeAgoObject -> convert_datetime($ts)); // Convert Date Time
$when = ($timeAgoObject -> makeAgo($convertedTime)); // Then convert to ago time
				
			
				echo '<tr id="topic_post">
							<td colspan ="2" ><div id="user-post"> ' . $creator . '<br/>' . gmdate("F j, Y, g:i a", strtotime($row2['post_date'])) . '</div>
							<div id="post-content"><div id="PostContentTopic"> ' . $row['topic_title'] . '<hr /></div>' . htmlentities(stripslashes($row2['post_content'])) . '<div id="PostContentDate"><hr /> Posted By:	' . $row2['user_name'] . '<br/>' . $when . '</div></div></td> </tr>';
				}



Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: WYSIWYG Display Error

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3635
  • View blog
  • Posts: 5,756
  • Joined: 08-June 10

Re: WYSIWYG Display Error

Posted 15 May 2013 - 11:11 AM

You are using the htmlentities function on the post body. That will convert any HTML special chars to their respective entities, so the user will see the code rather than having the browser render it.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1