Jump to content

CKEditor integration issues.


A_Olle

Recommended Posts

I'm trying to integrate CKEditor into my simple CMS. I got it to show up in the right spot, but there is another instance of the editor open at the top of the page, and I can't figure out why. Here is my code:

<?php
	require_once 'conn.php';
	include_once 'ckeditor/ckeditor.php';
    $CKEditor = new CKEditor();
    $CKEditor->editor('body');
	$title= '';
	$body= '';
	$article= '';
	$author_id= '';
	if (isset($_GET['a'])
		and $_GET['a'] == 'edit'
		and isset($_GET['article'])
		and $_GET['article']) {
			$sql = "SELECT title, body, author_id FROM cms_articles " .
			"WHERE article_id=" . $_GET['article'];
			$result = mysql_query($sql, $conn) or
				die ('Could not retrieve article data: ' . mysql_error());
			$row = mysql_fetch_array($result);
			$title = $row['title'];
			$body = $row['body'];
			$article = $_GET['article'];
			$author_id = $row['author_id'];
		}
		require_once 'header.php';
?>
	<form method="post" action="transact-article.php">
    	<h2>Compose Article</h2>
        <p>
        	Title: <br />
            <input type="text" class="ckeditor" name="title" maxlength="255" value="<?php echo htmlspecialchars($title); ?>" />
        </p>
        <p>
        	Body: <br />
            <textarea class="ckeditor" name="body" id="ckeditor"><?php echo htmlspecialchars($body); ?></textarea>
        </p>
        <p>
        	<?php
				echo '<input type="hidden" name="article" value="' .
				$article . "\" />\n";
				if ($_SESSION['access_lvl'] < 2) {
					echo '<input type="hidden" name="author_id" value="' .
					$author_id . "\" />\n";
				}
				if ($article) {
					echo '<input type="submit" class="submit" name="action" ' .
					"value=\"Save Changes\" />";
				} else {
					echo '<input type="submit" class="submit" name="action" ' .
					"value=\"Submit New Article\" />";
				}
			?>
		</p>
    </form>
<?php require_once 'footer.php'; ?>

Any help is MUCH appreciated!

Link to comment
https://forums.phpfreaks.com/topic/283996-ckeditor-integration-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.