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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.